Spawn shards in a PresentationWorld3D so they can’t push gameplay bodies.
A PresentationWorld3D is a second world that reads the gameplay world and never writes to it.
dotnet add package RecursiveAI.OnePhysicsRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OnePhysics.Physics3D; var game = new PhysicsWorld3D(); var follower = new PresentationWorld3D(); follower.SpawnShards(new(0, 2, 0), default); const float dt = 1f / 60; game.Step(dt); follower.Step(game, dt); Console.WriteLine(follower.CosmeticBodyCount);
Unzip the example, then dotnet run.
The snippet spawns shards two meters above the origin, then steps both worlds. SpawnShards creates 12 shards by default, so the snippet prints:
12The full program
The gameplay world owns a static floor. The follower copies it with Follow and sets Count = 4 to spawn four shards instead of the default 12. After the gameplay tick, take a snapshot and hash, step the follower, and compare both against gameplay state at that same tick.
using RecursiveAI.OnePhysics; using RecursiveAI.OnePhysics.Physics3D; using RecursiveAI.OnePhysics.Presentation; var game = new PhysicsWorld3D(new() { WorldId = 1 }); var floor = game.AddBox(new(10, 1, 10), at: new(0, -0.5, 0), type: BodyType.Static); var follower = new PresentationWorld3D(new() { WorldId = 2 }); follower.Follow(floor); follower.Debris = new PresentationDebris { Count = 4 }; follower.SpawnShards(new(0, 2, 0), new(0, 0, 0)); const float dt = 1f / 60; game.Step(dt); byte[] snapshot = game.Snapshot(); ulong hash = game.ComputeHash(); follower.Step(game, dt); // Compare at the same gameplay tick, not before and after game.Step. var sameBytes = snapshot.AsSpan().SequenceEqual(game.Snapshot()); Console.WriteLine($"Cosmetic bodies: {follower.CosmeticBodyCount}"); Console.WriteLine($"Gameplay snapshot unchanged: {sameBytes}"); Console.WriteLine($"Gameplay hash unchanged: {hash == game.ComputeHash()}");
Cosmetic bodies: 4 Gameplay snapshot unchanged: True Gameplay hash unchanged: True
If debris falls through gameplay geometry, check that the follower mirrors the collider with Follow. The follower does not copy every body automatically, and Follow does not copy sensors.
Variations
Keep only two dynamic cosmetic bodies. Insert this before the call to follower.Step in the full program:
follower.Quality = new PresentationQuality { MaxBodies = 2 };The next follower step prints Cosmetic bodies: 2; the gameplay snapshot and hash still match.
Related recipes
The short answer
Use PhysicsWorld3D for gameplay and PresentationWorld3D for effects. Call Follow for each gameplay body the debris needs to hit. Add the shards to the follower, then step gameplay before calling follower.Step(game, dt). The follower guide says, “The authority is only read: its bytes and its hash are the same with or without a follower”. There’s also a PresentationWorld2D for 2D worlds.
Can multiplayer debris be client-side only?
Yes, if it can’t change a gameplay outcome. A shard that rolls across the floor just for show can live in the follower. A fragment that blocks a doorway or trips a collision trigger belongs in the authoritative world: that’s the world the game uses to decide what happens. For a breakable wall, the large pieces that become obstacles can stay authoritative while decorative chips spawn in the follower. The fracture behavior distinguishes those authoritative fragments from the follower’s extra shards.
Follower bodies don’t travel in the gameplay snapshot. Rendering client-side shards therefore doesn’t require sending each shard’s pose as gameplay state. Don’t use those shards to settle hits or block movement: clients can have different cosmetic budgets, and shrinking the budget removes some bodies.
How can cosmetic debris collide with gameplay objects without affecting them?
Copy only the relevant colliders into the follower with Follow. A static floor gets a static copy. A moving body gets a kinematic mirror, a collider whose pose is controlled by gameplay rather than pushed by the shard simulation. The mirror rules describe which shapes are copied. The solver handles debris contacts against the mirror in the follower and does not apply those impulses back to gameplay.
If gameplay rolls back to a corrected state, pass its current world to the follower when stepping again. If a correction would move a mirror above the teleport speed or spin threshold, the follower places the mirror with zero velocity instead of using a large motion to catch up. The gameplay rollback still restores only the gameplay world.