Orient a Transform to a Specific Direction in Unity 3D

If you are too lazy to do the math to orient an object to a specific direction, this tip is useful for your.

The Transform objects in unity have the Forward, Up and Right properties. You probably don’t know that they are not only accessors but also mutators! You can simply assign a direction vector to an object’s Forward direction and the object will face that direction:

This can be handy sometimes, especially when you want to use the Kinect sensor inside the game. If the players arm direction signifies the orientation of something (eg. a sword), this tip saves you some time.

Leave a Reply

Your email address will not be published.