Get Rigidbody Time to Destination.

Hey how’s it going,

I am working on a physics based game and I have recently gotten some code that will rotate my character based on how long it is in the air and it will always land on a flat side, but to do this, I need to calculate the time to the destination. Because I am setting the velocity of the via

rigidBody.velocity = new Vector3(rigidBody.velocity.x,jumpForce*jumpForceMultiplier,moveSpeed);

is there anyway to calculate the time it will take for the object to hit the ground? I have a ground check method that is just raycasting to the collider bounds +0.1 to check of the player is on the ground, if that helps.

Thanks.

A trajectory can be calculated at any given time. Your current velocity can be used to simulate upcoming physics to predict where you will hit the ground.

I included a large number of formulas in a previous answer, so they can be used in conjunction with Raycasts for a simple test for where the center of a collider would reach. The more accuracy and reliability you want, the more expensive the calculations will become.