Question by
kylewetton · May 06, 2019 at 06:40 PM ·
rotationtransformquaternionslerp
Can't really grasp how to keep my player level on X and Z while using LookRotation
Here's my code, I'm pretty new to Quaternions and can't quite figure out what to alter here to keep my player rotating on the Y, but not X or Z.
Quaternion enemyDirection = Quaternion.LookRotation(targetPosition - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, enemyDirection, Time.deltaTime * 20f);
Thanks!
Comment
Your answer
Follow this Question
Related Questions
How to use Quaternion.Slerp with transform.LookAt? 3 Answers
unwanted rotation in y axis 0 Answers
[Solved] Smooth rotation with keydown 2 Answers
Questions about Rotations in unity 1 Answer
Quaternion.RotateTowards for camera positions is buggy 1 Answer