Question by
socialBacons · Jun 30, 2020 at 05:20 PM ·
c#movementinputplayer
How to specify forward direction for my character?
So I made this method to move my character but I would like it to be so I can specify wich direction is forward for my Character. Right now all the directions are global cordinates.
"movement" is from Inputactions.
protected virtual void HandleRotation()
{
if(movement.magnitude > 0.1f)
{
Quaternion lookDir = Quaternion.LookRotation(new Vector3(movement.x, 0, movement.y) + transform.position - transform.position);
finalLookDir = Quaternion.Slerp(transform.rotation, lookDir, Time.deltaTime * bodyLagSpeed);
transform.rotation = finalLookDir;
}
}
Comment
Your answer
Follow this Question
Related Questions
(Newbie's First Project) Object doesn't stop moving until long after I let go of the button 1 Answer
Acceleration only increasing when I press a key 0 Answers
[C#] Rotate player to camera forward look 0 Answers
Roll a Ball Tutorial issue 0 Answers
i need help making a dash ability for my endless runner game 2 Answers