Hi guys, I’m currently trying to make a 2D airplanes game and my goal right now is to achieve the same kind of gameplay you find in the version 1.0 of Luftrauser.
So I have a 3D aircraft model that I need to apply the correct rotations to so that the aircaft behaves like in Luuftrauser. So basically, the plane should always go towards it’s forward vector and the horizontal axis will determine the direction we go in.
I have determined that the movement I’m looking for is a simple “add the same amount of degrees on both X-axis and Z-axis”
Although, when I log the transform.rotation.eulerAngles
of my aircraft, I can see X and Z are changed but they don’t have the same value.
Here is the code I use for this rotation :
class PlayerController (MonoBehaviour):
public acceleration as single
public handling as single
def FixedUpdate ():
movementHorizontal as single = Input.GetAxis("Horizontal") * handling
movementVertical as single = Input.GetAxis("Vertical") * acceleration
rotationZ as Quaternion = Quaternion.AngleAxis(movementHorizontal, Vector3.right)
rotationX as Quaternion = Quaternion.AngleAxis(movementHorizontal, Vector3.forward)
transform.rotation = rotationZ * rotationX * transform.rotation
I’m not sure what’s wrong, the aircraft has a rigidbody and ideally I would like to achieve this rotation with it and not the Transform.