BulletSim ghost bodies: a removed mesh prim rebuilt its body anyway
What the operator felt
Walking the cottage path (2026-09-25) he was "stuck and pushed aside" by a flagstone that was phantom, and asked whether the shrubs had "a large collision box as well". They did: invisible, solid, bounding-box-sized.
What was proven (throwaway stones at (70..86, 60..64), a raycast and a dropped physical block)
- A mesh spawned and set phantom by script AT ONCE: raycasts still hit it while live; deleted, the body stays
behind with the same local id and no object (
name '?'), and a physical block dropped on it RESTS on it. - The same mesh set phantom 5 s after spawning: raycasts pass through; deleted, nothing remains.
- A mesh with no script, a mesh with a colour-only script, a phantom box prim: no ghost. So the trigger is removing a MESH prim from physics while its physics asset is still being fetched.
Why
BSShapes.VerifyMeshCreated fetches the mesh asset asynchronously; the callback calls
prim.ForceBodyShapeRebuild(false), which queues a taint that runs CreateGeomAndObject. When the prim was
removed from physics in between (phantom -> SOP.RemoveFromPhysics -> BSScene.RemovePrim -> BSPrim.Destroy,
or a delete), the queued rebuild still runs after the destroy taint and builds a new body that nothing tracks.
The fix (../bulletsim-ghost.diff, a unified diff of OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs against 0.9.3.0)
Destroy() sets a m_destroyed flag; ForceBodyShapeRebuild returns at once for a destroyed prim, and the
queued taint re-checks the flag before building. Built as OpenSim.Region.PhysicsModule.BulletS.dll.
Deploy
The region must restart for the DLL (and a restart alone clears every existing ghost and orphan: objects load
from the database with phantom already set, so no body is ever made). Console shutdown, copy the DLL into
opensim-src/bin within the supervisor's 60 s backoff, let the supervisor relaunch. Never start OpenSim by hand.
Workaround without the fix
Set phantom a few seconds after spawning a mesh, never in the same breath.