- Home /
How do I make a 3D character move and rotate (turn) the same direction they move? c#
Hi everyone, I am making a 3d game, and I am trying to make it move and rotate the same direction as it moves. And when the character rotates, I want a rotating animation to play. I would also like to use Q and E to rotate the camera. I really don't know how to do this. I'm new to making 3d games. (Just to let you know, I am not using the unity-made script. I am using a lego mini-figure as the character so thats part of the reason why I'm asking.)
Thank you for your help!
Hi!
First of all, what kind of look are you trying to achieve? First person, 3rd person, 2D etc.?
What is "it"? :) This is to let us better understand your question. Please be as specific as possible. Cheers!"I am making a 3d game, and I am trying to make it move and rotate the same direction as it moves."
I am trying to make a 3d game that is 3rd person @yoHasse
generally people here don't write entire scripts for you. this is a place for answers. to move something forward you can do something like this inside the update function:
float speed =5 * Time.deltaTime;
transform.position=transform.position +transform.forward *speed;
to rotate a character you can do this:
float speed = 10 * Time.deltaTime;
transform.Rotate(0, speed, 0);
after you get this working, then I would ask about animations. That's a different question.
You can probably save yourself a lot of trouble by learning the Unity Player Prefab, and then just replacing the character model with your own.
Your answer
Follow this Question
Related Questions
Help with Grid Movement 2 Answers
How to to not move when shooting? 0 Answers
Rotate camera only in 2 directions based on player touch 1 Answer
Trouble with correct move and rotation of Rigibody 0 Answers
Rotating Player 0 Answers