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 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.