Is there a way to make a character controller not slide along colliders, but rather stop moving when it collides with a wall?
I’m trying to implement a third person camera that doesn’t slide along walls, but rather adjusts it’s distance to the player and maintains the same angle to the player.
This is a snippit of code–
function LateUpdate(){
cameraTransform.position = (target.position);
theController.Move(-cameraTransform.forward * cameraDistance);
}
function OnControllerColliderHit (hit : ControllerColliderHit){
cameraDistance = (cameraTransform.position - target.position).magnitude;
print(cameraDistance); //this = 0 ??
}
Do the variables not update while the Move() function is called? Maybe there is a better way to do this…