Get the total rotation while flying

Hello all !

I want to begin a stunt game. But i’m stuck in the different figures, i can’t get the total rotation of the car while air time. I try every possibilities but it doesn’t work.
Does anybody know how to do that ?

Thanks

Each frame, count the amount of rotation since the last frame, and add that to the total. If the difference is above 180 degrees, subtract it from 360, and add THAT number.

var total = 0.0;
var lastrot = 0.0;
function Awake()
{
lastrot = transform.localRotation.eulerAngles.x;
}
function Update()
{
var rot = transform.localRotation.eulerAngles.x - lastrot;
lastrot = transform.localRotation.eulerAngles.x;
if (rot > 180)
rot = 360 - rot;
total += rot;
}

This IS however unreliable.

If you have a rigidbody attached, just add the relative angular velocity to the total. This is INCREDIBLY reliable, but it cannot, however, account for non rigidbody rotations.

var total : Vector3;
function Update()
{
var rot = transform.InverseTransformDirection(rigidbody.angularVelocity)
rot *= Time.deltaTime;
total.x += rot.x;
total.y += rot.y;
total.z += rot.z;
}