centersstar.blogg.se

War thunder with controller
War thunder with controller











  1. #War thunder with controller update#
  2. #War thunder with controller download#

Used to rotate a camera to face the aim position. This way, when the user moves the mouse left, the apparent position of the MouseAimPos (and consequently your cursor) should also move left on the screen regardless of the current orientation. In order to keep the rotations intuitive, the rotations must happen relative to the camera. The MouseAimPos is the forward of this transform multiplied by the Aim Distance given in the inspector. This is an empty transform that is rotated directly by the mouse in order to generate the MouseAimPos. Having this set wrong will result in jittery looking movement.

#War thunder with controller update#

You'll want to check the Use Fixed option depending on if the aircraft is moved in Update or FixedUpdate loops. The reference transform used for both the boresight position and for the rig to follow. This separation allows for accurate pointing with the mouse while maintaining smooth camera motion. As can be seen in the expanded hierarchy of the rig prefab, one transform is rotated directly by the mouse and used to point towards a direction, while the camera transform smoothly looks in this direction using its own, separate rig. To get around this and emphasize the mouse's pointing ability, the camera and mouse control need to be separated.

war thunder with controller

Examples of this style of control would be the Halo games or World of Warplanes. While this definitely does work, it can be a bit clumsy and make for some jarring camera movement depending on your game. The simplest way to accomplish this idea is to have an orbit camera that gets rotated by the mouse, crosshair in the middle of the screen, and then wherever the camera is pointed is where the plane flies. If you want to aim at something, just put the mouse cursor over it. If you want to fly towards something, you simply put the mouse cursor over it and the plane will fly towards it. What the control scheme in this project does is allow the player to use the mouse as a pointing device to fly the plane. While these can work, they don't take advantage of the mouse's greatest strength: as a pointing device. Most control schemes involve using the mouse as a substitute for a joystick or otherwise directly controlling the aircraft. The mouse is not an ideal method of controlling an aircraft. An extremely simple HUD is also included to demonstrate how it's supposed to work. To give an example of how you might do this, the demo includes a very simple Rigidbody based airplane with the steering behaviors necessary to fly itself. How your aircraft actually flies towards that point is an implementation detail specific to your project and will require scripting. The camera rig only handles telling where the aircraft is meant to fly.

  • Use the MouseFlightController.MouseAimPos and MouseFlightController.BoresightPos C# properties to draw HUD elements for the mouse cursor and aircraft's direction respectively.
  • In code, use the MouseFlightController.MouseAimPos C# property to get the world postion the mouse cursor is pointing to.
  • Assign your vehicle's transform to the Aircraft property in the MouseFlightController's Inspector.
  • Drop the MouseFlightRig prefab into your scene.
  • The core of this project is the MouseFlightController component and the MouseFlightRig prefab. Sometimes you might want to manually control the pitch or roll for a maneuver, so a couple keyboard overrides exist. The plane will automatically try to fly towards the crosshair.

    war thunder with controller war thunder with controller

    The circle is controlled by the mouse, while the crosshair shows where the plane is pointed. To fly the demo plane, simply move the mouse around.

    #War thunder with controller download#

    You can either clone the repository or download the asset package located in the root. (Open Window->Lighting->Settings, then click the gear icon on the top right -> Reset.) Download Note: When importing the package into 5.6.4, the demo scene will need to have its lighting reset. This project was built in Unity 2017.3.1f1, and tested in 2018.3.0 and 5.6.4. It is in my opinion the single best and most robust system for controlling aircraft, especially those with more realistic physics. This project is an example of mouse controls for aircraft based on the excellent system used by Gaijin's War Thunder.













    War thunder with controller