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

Difference between PhysicsWorld, DynamicsWorld, CollisionWorld

Discussion in 'Physics for ECS' started by artyomik14, Aug 24, 2020.

  1. artyomik14

    artyomik14

    Joined:
    Feb 26, 2020
    Posts:
    6
    Can someone explain to me the difference between PhysicsWorld, CollisionWorld, and DynamicsWorld?
    What is the purpose of these worlds?
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    DynamicsWorld holds only the data related to movement of bodies, so it's the only thing the physics solver accesses. CollisionWorld holds the body collision data and can actually be used even without a full physics step because it encapsulates logic for collision and finding overlapping bodies, as well as queries. Finally, PhysicsWorld is a collection of one DynamicsWorld and one CollisionWorld and presents a full physics solution. It's just the way how data is laid out. You are never expected to use the DynamicsWorld on its own, so either use PhysicsWorld if you need a full physics step, or just CollisionWorld if you're only into queries.