Difference between PhysicsWorldSingleton and PhysicsWorld

In 0.51 I was using

World world = World.DefaultGameObjectInjectionWorld;
BuildPhysicsWorld buildPhysicsWorld = world.GetExistingSystem<Unity.Physics.Systems.BuildPhysicsWorld>();

CollisionWorld collisionWorld = buildPhysicsWorld.PhysicsWorld.CollisionWorld;

I’m assuming I now need to use:

physicsWorld = SystemAPI.GetSingleton<Unity.Physics.PhysicsWorldSingleton>().PhysicsWorld;
CollisionWorld collisionWorld = physicsWorld.CollisionWorld;

My question is, when should I use physicsWorldSingleton and when should I use physicsWorld? What’s the difference?

PhysicsWorldSingleton is there to be able to store a PhysicsWorld as a singleton in the entity world, as well as identify the current physics world index for when multiple physics worlds are being used. PhysicsWorldSingleton > PhysicsWorld > CollisionWorld/DynamicsWorld mostly expose the same things from the things they contain, but I’d suggest taking the most specific struct that has everything you want for making calls / accesses, like

var collisionWorld = SystemAPI.GetSingleton<Unity.Physics.PhysicsWorldSingleton>().PhysicsWorld.CollisionWorld;

for performing queries. This would reduce the number of nested property accesses and method calls that occur, though I suspect the distinction would be negligible in Burst. I would also recommend being specific with job fields, like using a CollisionWorld field when you’re just performing casts.