Skip to main content
Up and Coming
January 8, 2014

Look Flight Mechanics

Maybe someone clever can shed some light on how to implement something im wanting to test.

I have a Rigidbody with a nice force based flight script using the controller, say if i want it to switch over to a look based flight, how would i alter my script to apply relative torque based on moving my head?

here is what i have working with the controller

rigidbody.AddRelativeTorque(pitch*PitchSensitivity*Time.deltaTime

Cheers
    This topic has been closed for replies.

    4 replies

    Participant
    January 8, 2014
    Figure out if the camera is pointing in the same direction as the plane, and if not, figure out the angles. Use those to calculate how much torque should be applied to the plane, and use those floats in AddRelativeTorque(float x, float y, float z). That way the amount of torque increases when you move your head further away (If you're faster than the torque that is applied), and it max out at 90 degrees or something.
    Up and Coming
    January 8, 2014
    I understand the theory of what needs to be done, was hoping someone could help me express that in javascript.

    thanks anyway
    Ambient Flight Eagle Flight Experience Dinosaur Voyage Running from Dinosaurs
    Up and Coming
    January 17, 2014
    In C#

    Quaternion head_tilt = Quaternion.identity;
    OVRDevice.GetOrientation(0, ref head_tilt);
    head_tilt.ToAngleAxis(out head_tilt_angle, out head_tilt_vector);

    out head_tilt_angle is a float i think, out head_tilt_vector is vector3 data, I think out head_tilt_vector.x is good head tilt info, print out the results when you tilt your head to see what you're working with.

    then just use head_tilt_vector values to determine head movement and apply those values to your torque function I guess.
    Up and Coming
    January 20, 2014
    Thanks, its all sorted now
    Ambient Flight Eagle Flight Experience Dinosaur Voyage Running from Dinosaurs