Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

DOTS vs isKinematic and DOTS vs Native Physics interactions

Discussion in 'Physics for ECS' started by RafKie, Apr 11, 2020.

  1. RafKie

    RafKie

    Joined:
    Sep 13, 2019
    Posts:
    2
    Hi,
    I'm building a game where I don't use DOTS, but I thought maybe I could benefit from it in a particular use case:

    Without going into details, I want to apply physics to hundreds of entities simultaneously- say an explosion force. If I were to do it with GameObjects, it obviously wouldn't be very performant. However, DOTS should theoretically do the trick, right?

    First question - if I want to "enable" the dynamic physics on the objects, like in regular workflow I would uncheck the "isKinematic" checkbox, how do I do this with DOTS? Is it about creating the EntityCommandBuffer and then adding the PhysicsMass component to my entity?

    Second question - if I wanted these entities to collide with regular GameObjects on scene, which have regular Rigidbodies and Colliders attached to them, would that be possible?
     
  2. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
    1) As you said, to "enable" dynamic physics, you need to add the PhysicsMass component. The 'Change Motion Type' demos aims to show that.

    2) The GameObjects and DOTS versions of physics are entirely separate. You'll need to convert appropriate GameObjects to Entities (via the legacy conversation system) and update in both physics simulations. I assume the GameObjects would then be authoritative and the DOTS cloned bodies would be kinematic and keyframed to the GameObject transforms.