Do they sometimes randomly trigger off when the player moves?
How does the standard asset “CharacterMotor” apply gravity to the player?
Do they sometimes randomly trigger off when the player moves?
How does the standard asset “CharacterMotor” apply gravity to the player?
I found it not to be reliable as I am using a mechicam animation system for a third person shooter and opted towards a character controller for my player rather than a rigidbody after much trial and error with that. I found that my CharacterController.isGrounded did not update after it was marked true as i always start my characters in the air, so I made my own isgrounded application and here is the code for it.
private Vector3 grav;
private CollisionFlags collisionFlags;
private float gravity = 9.8f;
void Update () {
if (IsGrounded()) {
grav.y += -gravity * Time.deltaTime;
cc.Move (grav * Time.deltaTime);
} else {
grav = new Vector3(0,0,0);
}
}
public bool IsGrounded () {
return (CollisionFlags.CollidedBelow) != 0;
}
It is a bit jittery with my character going up and down hills but that requires some smoothing out which I haven’t gotten to yet as I made this script today. Bonus points for not using a RayCast system? Hope it helps