- Home /
Problem with Rotation and Character controller
I have a problem with the rotation of my character, when rotating my character, only that by turning the grid and not the capsule collider.
show the images here:
and my code
var tempDir1 = new Vector3(objetivo.transform.position.x,0,
objetivo.transform.position.z);
var tempDir2 = new Vector3(transform.position.x,0,
transform.position.z);
var dir = tempDir1 - tempDir2;
var rot = Quaternion.LookRotation(dir, Vector3.up);
transform.rotation = Quaternion.Slerp (transform.rotation, rot, Time.deltaTime * 20);
transform.rotation.x=0;
transform.rotation.z=0;
dir.Normalize();
Answer by Peter G · Aug 15, 2010 at 11:07 PM
The problem is that your mesh isn't set up correctly in the modeler. The origin in your modeler will be the pivot point on your mesh, so you need to go into your modeler and move the mesh so that the y-axis goes through the center. Then you will need to re-offset the character controller.
solve the problem as centering the mesh in the capsule, and NOT the capsule in the mesh
Your answer
![](https://koobas.hobune.stream/wayback/20220613071303im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Strange bug with First Person Controller in 3.5 beta? 0 Answers
Character Controller - Rotate toward direction 1 Answer
how to rotate character controller? 0 Answers
Help with my Character Controller 1 Answer
Character Controller Rotation 4 Answers