Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Hovercar sinking into ground at high speed

Discussion in 'Physics' started by randallthymes, Jan 19, 2024.

  1. randallthymes


    Jan 19, 2024
    I have a hovercar that uses raycasts from each of its' corners to hover a fixed height above the ground, however, there is a huge problem that happens when it reaches a high enough speed and tries to climb up a ramp that has too much angle: the hovercar will lower/sink to the ground. I have tried several implementations of the hovering forces, but the problem still remains.

    I have been searching for a solution to this problem for about a week now but I have found zero useful information. If anyone has any idea how to solve it, please let me know as I have legitimately been losing sleep over this.
  2. MelvMay


    Unity Technologies

    May 24, 2013
    Maybe use CircleCollider2D or SphereCollider on the corners instead (virtual wheels). That way you can set a radius and the physics engine will solve any overlap keeping you a set distance away from that surface.
    codebiscuits likes this.
  3. tjmaul


    Aug 29, 2018
    Hey @randallthymes ,
    Can you post the code you’re using to calculate the force from the raycast? I have a suspicion you’re doing the damping wrong :)
  4. Gabo_campitelli


    Oct 17, 2012
    It looks like the behaviour you mention is expected.
    Can't you just clamp the rigidbody position from the raycast?

    Have in consideration that you don't have to apply Physics in all axis. You could manipulate the Transform vertically with out involving physics and use physics for every thing else.