- Home /
A* Pathfinding Turn Off Rotation
I have a 2D Sprite moving around a 3D world, so I am using A* Pathfinding but it attempts to rotate my little characters sprite in the direction that he is about to walk. But I need that sprite to face the camera.
When I moved Rotation Speed to 0 for the AI Path script it seemed to prevent my character from moving anywhere except the way he was facing.
Answer by spiderman20084 · Nov 01, 2017 at 06:35 PM
OK ... i seem to have found a solution to this problem just open the "AI path" script and comment these lines
var currentRotationSpeed = rotationSpeed * Mathf.Clamp01((Mathf.Sqrt(slowdown) - 0.3f) / 0.7f);
RotateTowards(velocity2D, currentRotationSpeed * deltaTime);
they are lines number 294&295 to be exact. and in the rigidbody2d freeze z rotation. :D that's it
Answer by unity_ibqUxLJRjujkUA · Nov 19, 2020 at 12:48 PM
I might be wrong cause i am a beginner but i think this is what you are asking for, GetComponent().enableRotation = false;
Your answer
Follow this Question
Related Questions
A* endless loop 0 Answers
A* pathfinding generating new path when created new obstacle 0 Answers
A* Pathfinding AB Path usage without Seeker 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers