- Home /
NPC CharacterController doesn't move or stops randomly
I have a robot (from "3d Platform tutorial"), but it doesn't move or stops randomly when chasing the player. I tried fiddling with the CharacterController parameters, changing capsule collider height, Y position, but can't get it to work correctly (Until I make the capsule excessively big (like 7 in height)). I replaced AI code with a simple follower code:
function Follow() { while(true) { // get position difference vector var dist = (target.position - characterController.transform.position);
// look at target ignoring Y axis
transform.LookAt(Vector3(target.position.x, characterController.transform.position.y, target.position.z));
characterController.SimpleMove(dist.normalized);
yield;
}
}
I managed to get it to work on a flat surface, but then it can't step up a bit raised platform. Here's a picture of situation and CharacterController parameters:
Slope limit = 45
Step offset = 0.5
Skin width = 0.08
Min move distance = 0
Center.Y = 1.38
Radius = 0.7
Height = 2.72
Thank you.
Your answer
Follow this Question
Related Questions
Any way to disable SimpleMove's sliding? 1 Answer
Move() function doesn't work on character controller! 0 Answers
CharacterController Move vs. SimpleMove 1 Answer
Character Controller Won't SimpleMove() 0 Answers
Switching from SimpleMove to Move 1 Answer