Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question DOTS Physics fast moving objects collide before touching other objects.

Discussion in 'Physics for ECS' started by PadelVR, Jul 21, 2022.

  1. PadelVR

    PadelVR

    Joined:
    Feb 9, 2022
    Posts:
    39
    Hi,

    I have a ball and a surface that are both entities using the new DOTS Physics Package.

    When the ball moves fast (more or less the same speed as when you throw a ball with your hand),
    the ball collides with the surface around 20 cm (0.656168 ft) before touching the surface and bounces back.

    This only happens if it moves fast.

    Does anyone know how can I change this behaviour or at least reduce it?

    Thank you.

    EDIT: I have found a float called CollisionTolerance by doing this:
    World.DefaultGameObjectInjectionWorld.GetExistingSystem<BuildPhysicsWorld>().PhysicsWorld.CollisionWorld.CollisionTolerance;

    Unfortunately it says its read only and I can't reassign it. I tried to create a new Collision World and the replace the current world with the new one but to no avail. I can't even change the value on the new world. Any ideas?
     
    Last edited: Jul 21, 2022
  2. Krooq

    Krooq

    Joined:
    Jan 30, 2013
    Posts:
    196
    I think the way to do this in DOTS is to change the solver iteration count which of course affects the entire simulation, not just a single entity as the collision detection mode in gameobject based workflows would.

    You could try moving the entity to a location that ensures it will or wont collide during the simulation to account for this tolerance. Usually for fast moving objects one needs to do some manual fudgery.

    upload_2022-7-27_12-22-12.png
     
    PadelVR likes this.