I’m trying to detect if my player is falling by tracking if his Y position is decreasing, however it doesn’t seem to be working. I’m keeping track of his latest Y position in LateUpdate but it doesn’t make a difference; is there a better way to tell if his Y position is decreasing or better yet get the decrease rate?
void Update()
{
if(!player.GetComponent<GroundedCharacterController>().isGrounded){
if(cineTransposer.m_FollowOffset != fallingOffset && player.transform.position.y < lastYPos){
StartCoroutine(LerpToFallingOffset());
}
}else{
if(cineTransposer.m_FollowOffset != standingOffset){
StartCoroutine(LerpToStandingOffset());
}
}
}
void LateUpdate(){
lastYPos = player.transform.position.y;
Debug.Log("last y pos is " + lastYPos);
}