Determine Rotation
jamie_c
ImagineLabs.rocksMember, PRO Posts: 5,772
I have a rolling object in my game that I want to spawn a particle effect every time it rolls to 0° (each full rotation). I was thinking it would be as simple as checking the Rotation Value for the actor but this keeps going past 360° as it rolls and does not loop around from 360 to 0 and start over. Is there a calculation to determine when the rotation has 'looped' back to 0? (I'm no math wiz I'm afraid...)
Comments
self.Rotation%360
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
Thanks very much, i'll give that a try.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
If rotation=360 then rotation=0 ?
My Blog / App Store / Google Play
You will never be able to hit a perfect 0° - except in a few very rare circumstances depending on rotation speed - so you really need to be checking if rotation is > than 0°, but this won't work either due to rounding issues, so you need to check that the rotation is > than 0° + a small amount (for example 0.001°)
So for example . . .
When numeric expression rotation%360 > 0.001
--Timer for X seconds
----Do some particles.
Make sure to check run to completion
Hey guys, thanks for the help. It works perfect thanks to the tips above.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page