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

Question Walking under slope pushes player through the floor.

Discussion in 'Physics' started by bebros2, Nov 23, 2022.

  1. bebros2

    bebros2

    Joined:
    Aug 28, 2021
    Posts:
    36
    When I move the player under a ramp/slope the farther I walk under the slope the more I'm pushed into the floor then I just clip through the floor. For some extra information: I'm using MovePosition to move the player. My rigidbody has continuous dynamic selected. The ramp is a regular box collider, and my player is a capsule collider. Is there any simple way to stop it from clipping under?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,589
    MovePosition is meant for Kinematic Rigidbody in 3D, not Dynamic. In Dynamic it'll teleport it to that position. Then the solver will try to solve it, likely finding itself in an impossible situation such as having a ramp on the top and floor on the bottom; there's no correct solution to that.

    If it's Dynamic, use forces, velocity etc.
     
    bebros2 likes this.