kriket Posted November 10, 2015 Share Posted November 10, 2015 I have this physics-based car game where I want to reward points for a full backflip (360 rotation) of the car when in the air. The car can backflip just fine under physics, but I dont know how to record one backflip, for example. How can I go about getting this done? Any pointers. Appreciate it. Link to comment Share on other sites More sharing options...
in mono Posted November 10, 2015 Share Posted November 10, 2015 Let's suppose that a backflip can only happen when the car is off the ground - in this case, you can store the angle of the car when it is taking off, then incrementally compare its angle with a few fractions of 360 (plus the initial angle) - maybe at least two or three. Then check the angle in the update and if it passes the first increment (e.g. 120 in case there are three), raise a flag, if it then also passes the second one (e.g. 240), raise a second flag, and if at the end the angle is 0 and the flags are still raised, you've most probably done a full rotation. If it happens that you can rotate the car back and forth, you may also need to lower the flag if for example the car rotates past 120 degrees and then back. P.S. Now that I think of it, it may work with only one check (at 180 degrees), but I haven't tried it. kriket 1 Link to comment Share on other sites More sharing options...
Recommended Posts