- Home /
Tracking Rotation for Flips/rolls
I need to track the rotation of a car on its Z and X axis to check how many times it has flipped or rolled (gone 360 degrees + or - in the Z and or X directions before landing) I already know how to track when the car leaves the ground and lands again, but because eulers reset to 0 once exceeding 360 degrees I can't track beyone one roll or flip.
If eulers could track beyond 360d I could divide the difference between the start and end rotation by 360 and then determine how many rolls or flips there are from that, but I can't. Help anyone?
Answer by efge · Mar 15, 2011 at 11:22 AM
You could check localEulerAngles:
if(transform.localEulerAngles.z > 80 && transform.localEulerAngles.z < 280)
and then set a counter to +1.
(You might need to set a variable to true every time when it's flipped to increase the count only once per flip.)
Answer by Ben W · Mar 15, 2011 at 04:02 PM
even when using the boolean statement it's adding dozens of points too many when the car isn't even rotating that much x.x
Unity and rotations seems cursed to me
Answer by hellobard · Jan 31, 2013 at 01:51 PM
I had the same problem Ben, just gives a crazy amount of points.
Your answer
Follow this Question
Related Questions
How to make car land on 4 wheels and maintain speed? 0 Answers
Why is my rotation so weird? 1 Answer
eulerAngles.y always returns 179.9999 1 Answer
Rotating, stopping, rotating again. 2 Answers
Object Rotation Sliders 1 Answer