- Home /
Problem with CharacterController.SimpleMove
I'm having trouble using CharacterConroller.SimpleMove to implement a 3rd person click-to-move system. I've followed examples in some similar posts in regards to calculating the right direction to pass to SimpleMove for my character as follows:
Vector3 diff = destinationPoint - _transform.position;
diff.y = 0;
_controller.SimpleMove (diff.normalized * _moveSpeed);
This appears to work and my character moves in the right direction. What I'm noticing however is that if I quickly click back and forth between two points on the same axis, my character will appear to continue moving in the prior direction before changing directions and moving towards the new point.
At first I suspected that I was not passing the correct destination point, however I added some logging to when I click and to track each vector passed to SimpleMove and I can see in my Update loop that when I hit detect a new destination point I start passing the updated vector to SimpleMove so I can't account for why my character onscreen appears to still move in the old direction for a few frames.
Based on suggestions in other posts, I added a call to SimpleMove(Vector3.zero) to stop all movement in the prior direction when I detect a new destination point has been selected but that doesn't seem to help the problem.