- Home /
[Rephrased] How to make an object face in the direction it's going
Hello! my name is Juan. I've had a question for a long time and I just realized how to rephrase it in such way that it'll be easier to understand. I want to make it so that when the character is in the air (I already got that figured out) i want it too be facing in the direction it is going in. kind of like the way an airplane faces in the direction it's going. I would really appreciate any answers, but if possible explain like I'm a 5 year old. Thanks in advance!
~Juan Callejas
Answer by Firedan1176 · Jan 25, 2015 at 02:54 AM
If your player has a rigidbody, you could try:
GameObject target;
void Update() {
if(target == null) {
target = new GameObject();
}
else {
target.transform.position = GetComponent<Rigidbody>().velocity;
transform.LookAt(target);
}
}
If your player doesn't have a rigidbody, you can use a simple script to calculate it.
I'm pretty sure this won't work but I'm tired. Sorry.
that would make the character follow the game object but how would that make it follow the direction it is going towards?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Flip over an object (smooth transition) 3 Answers