Keeping track of vehicle rotation?

Hey guys,
I’m trying to figure out how to tell when my vehicle does a complete 360 degrees flip. What I need to do is when the player jumps the bike, is store the current rotation, and as the bike rotates backwards or forward, I need to keep track of the rotation and detect when it gets back to the starting rotation stored when the player first started the jump.

I am not quite sure what to use to store the starting rotation. Should I use rigidbody.rotation or trabsform.eulerAngles or maybe transform.up…then I imagine keeping track of the rotation would be something similar to:

// Starting rotation
Vector3 startRotation = Vector3.Zero;

if( bikeJustLeftGround == true )
    startRotation = transform.eulerAngles;
    bikeJustLeftGround = false;

// rotation of bike compared to starting rotation
float currentRotation = Vector3.Dot( transform.up, startRotation );

// And then...
if( currentRotation == startRotation.z )
    Debug.Log("DID A FLIP!!!");

I can’t really get the above code to behave the way I need it to behave. Rotations confuse me and I need some help on this one for sure haha

Thanks for your time guys!

Quaternion.Angle() is one good bet for this problem. Instead of saving the eularAngles do something like:

Quaternion qInitial = transform.rotation;

Then you can test for the current rotation with:

Quaternion.Angle(qInitial, transform.rotation);

I don’t know how your game works, but you might first have to detect that the vehicle made it past 90 degress first and then give some sort fudge factor (i.e. the flip is successful when the angle is back under 20 degrees).