Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Creating specific physicsworlds for immediate physics?

Discussion in 'Physics for ECS' started by Bas-Smit, Feb 24, 2021.

  1. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    267
    I would like to predict the trajectories of certain bodies in my simulation and am considering
    Simulation.StepImmediate. I looked at the pool example and largely got it to work. Im struggling a bit obtaining specific PhysicsWorlds though. For instance, I would like to have a PhysicsWorld that contains all static bodies and a specific subset of dynamic bodies. Any ideas on how to set this up?
     
  2. milos85miki

    milos85miki

    Joined:
    Nov 29, 2019
    Posts:
    197
    You can create the other PhysicsWorld and control what goes into it. One option is to copy the bodies (and their motions) from the main PhysicsWorld.
    I'd recommend looking at the UnityPhysicsSamples\Assets\Tests\SingleThreadedPhysics\Scripts\SingleThreadedPhysics.cs example.
     
    Bas-Smit likes this.