Link to home
Create AccountLog in
Avatar of James Hancock
James HancockFlag for United States of America

asked on

Unity C# game code - how do I detect when my gameobjects have finished a rotation?

Hi


My unity game engine workings are nearly done. For aesthetics sake, I'm making it so that when one of the game-letters is ready to be placed, it flies in from the queue on the side. That spins as it moves, and I'd like it to stop spinning soon once it is settled. Will be quick code - 

I simply need to know when it is upright again, (Vector3 starting angle? approximation?)

The euler angle component of a game-object doesn't seem to be the way to solve this.

Is there Vector3.UP or some constant to detect once the letter has returned to the 3D start angle? What should I do?

Thanks

Avatar of James Hancock
James Hancock
Flag of United States of America image

ASKER

Interesting, in the awake method of these tile objects, I put



        print("Spinner awake, angle = " + transform.eulerAngles);


Which gives,


Spinner awake, angle = (0.0,0.0,0.0)

Open in new window

That's probably it! 


How do I test for that? I guess euler angles has what I need, after all. Are they comparable as objects?

Thanks

ASKER CERTIFIED SOLUTION
Avatar of ambience
ambience
Flag of Pakistan image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer

Thanks