- Home /
how to get an object to point the direction it is moving in unity
I have no idea where to start scriting, how would I get the rocket to orient its self to the direction it's moving?
https://www.youtube.com/watch?v=hhwcXJWYDFE&feature=youtu.be
Answer by Anxo · Sep 17, 2014 at 09:46 PM
If you apply a rigid body, you can check which direction it is moving by returning the rigidbody.velocity. If you want to face your object in that direction you can just say transform.forward = rigidbody.velocity.
But this question has been answered many times so please put in the effort and check before you ask.
And if he isn't using a rigidbody, he can just use transform.LookAt
on the move operation.
Ok thanks, I hadn't thought about prior research, will next time
Do not use answers to answer in the place of comments as people from the community will get emails and wont be happy. If your object is off by 90degreees you can do a few things, you can say transform.right = rigidbody.velocity, you can place the object as a child into another empty game object and then rotate it 90 degrees and attach the script to the parent ins$$anonymous$$d or if it is an imported object you can change the orientation in your 3d package and reimport it.
Also, if this satisfies your question, click the checkbox next to the answer to allow other people to know that this question was answered and no longer needs to be looked at unless you are searching for the answer.
Answer by SuperPurpleByte · Sep 18, 2014 at 07:35 PM
What do I do if the rotation is off by 90 degrees?
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Rotating An Object On Its Axis Once 3 Answers
rotating an object only on z-axis help - c# 2 Answers
top down 3d camera rotation question 2 Answers
How to script a forever going swing? 1 Answer