Search Unity

Question How to control depenetration velocity?

Discussion in 'Physics for ECS' started by gtzpower, Nov 5, 2021.

  1. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    I am trying to recreate some code that modifies the Rigidbody.maxDepenetrationVelocity in the classic physics system. I have looked at the contact modification example, and in playing with it, I cannot seem to get a proper result. I moved the "soft contact" cube into the ground slightly, and it consistently shoots up on play, even if I have modified the contact so much that it sinks right into the ground upon landing.

    Any suggestions for how I can get the cube to slowly raise up to the surface?
     
    Last edited: Nov 5, 2021
  2. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    Contact modification not working seems to only be an issue on startup. If I disable the cube, hit play, then enable the cube, I get the soft depenetration that I am looking for. I think that this won't be a problem in my use case as I need it for objects being instantiated at runtime, not ones that exist during startup.