---
title: "Simulate cosmetic debris separately from gameplay physics in C#"
url: https://recursiveai.org/onephysics/cookbook/simulate-cosmetic-debris-in-follower-world/
description: "Simulate visual debris in a separate OnePhysics follower world in C#. Let shards collide with copied geometry without changing gameplay snapshots or hashes."
version: "1.3.0"
---

# Simulate cosmetic debris separately from gameplay physics in C#

**OnePhysics** is a free, open-source physics library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OnePhysics) · [GitHub](https://github.com/recursive-ai-oss/onephysics-csharp) · [Docs](https://recursiveai.org/onephysics/docs/) · [Download example (.zip)](https://recursiveai.org/onephysics/cookbook/simulate-cosmetic-debris-in-follower-world/simulate-cosmetic-debris-in-follower-world.zip)

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.

```shell
dotnet add package RecursiveAI.OnePhysics
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
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](https://recursiveai.org/onephysics/cookbook/simulate-cosmetic-debris-in-follower-world/simulate-cosmetic-debris-in-follower-world.zip), 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:

```text
12
```

## The 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.

```csharp
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()}");
```

```text
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:

```csharp
follower.Quality = new PresentationQuality { MaxBodies = 2 };
```

The next follower step prints `Cosmetic bodies: 2`; the gameplay snapshot and hash still match.

## Related recipes

- [Fracture a rigid body](https://recursiveai.org/onephysics/cookbook/fracture-rigid-body/)
- [Snapshot and restore a physics world](https://recursiveai.org/onephysics/cookbook/rollback/)

## 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](https://github.com/recursive-ai-oss/onephysics-csharp/blob/a5f45b1c8e34091892655a5f5536abb14d32528b/docs/guide/presentation.md#L21-L30) 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](https://github.com/recursive-ai-oss/onephysics-csharp/blob/a5f45b1c8e34091892655a5f5536abb14d32528b/docs/guide/presentation.md#L36-L42) 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](https://github.com/recursive-ai-oss/onephysics-csharp/blob/a5f45b1c8e34091892655a5f5536abb14d32528b/docs/guide/presentation.md#L5-L13) 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](https://github.com/recursive-ai-oss/onephysics-csharp/blob/a5f45b1c8e34091892655a5f5536abb14d32528b/docs/guide/presentation.md#L44-L48), 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.
