- Home /
How do I make my player face the way he walks?
I just got into unity and I can't seem to make my character face left if he walks left. If I could get some help that would be great. :)
transform.rotation=Quaternion.SetLookRotation(direction);
http://docs.unity3d.com/ScriptReference/Quaternion.SetLookRotation.html
just watch a tutorial on how to script a 1st person controller, I am sure there is millions
Answer by revolute · Apr 20, 2015 at 01:09 AM
This might be hacky but should do the work:
Vector3 movingDirection;
transform.forward = movingDirection.normalized;
I do this whenever I feel lazy and want to do this quick.
Uh... How did it make the game laggy..?
I'm using this to make a $$anonymous$$i 3D game with more than 40 monsters in a field and with my Galaxy Note 2 and still gets a stable frame rate of 60.
I don't know. It just got choppy when I added that code. The game I had was a simple cylinder walking around. Nothing really to make it lag.
Answer by lordlycastle · Apr 20, 2015 at 03:12 PM
There are many ways you can do this. Such as Transform.LookAt, Rigidbody.MoveRotation, Vector3.RoatateTowards, Quaternion.RatateTowards etc. If you are absolute beginner and aren’t familiar to using these functions then I would suggest you watch some tutorials. A simple Google search should give several results. If you want a good hand-on intro you can follow the Unity example project here, it includes movement among other essential intros.
Your answer
Follow this Question
Related Questions
A different kind of billboarding for particles.. 3 Answers
Camera rotation around player while following. 6 Answers
How do I keep a character from rotating? 3 Answers
Character always facing mouse cursor position... 3 Answers
How do I make one GameObject Point Towards another GameObject in 2D? 1 Answer