James Hancock

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

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER

Thanks

ASKER

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

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

Which gives,

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