Search Unity

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

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

  1. aducceschi

    aducceschi

    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
     
    aducceschi likes this.