I am trying to add a react-three/drei texture to a rigid body like this:
<RigidBody type="fixed" name="floor" friction={0.7}>
{/* Collider 1: A 'box' collider with a certain material */}
<CuboidCollider restitution={0.9} friction={0.2} args={[100, 1, 100]} />
{/* Render geometry (visual only) */}
<mesh>
<boxGeometry args={[100, 1, 100]} />
<MeshReflectorMaterial
blur={[300, 100]}
resolution={2048}
mixBlur={1}
mixStrength={40}
roughness={1}
depthScale={1.2}
minDepthThreshold={0.4}
maxDepthThreshold={1.4}
color="#101010"
metalness={0.5}
/>
</mesh>
</RigidBody>
The material appears to be rendered correctly and the collider behaves as I would expect but it seems to cause unexplained behaviours of my other objects in the scene - some go missing, some are teleported to a different place (????). All of this strangeness stops as soon as I remove the <mesh></mesh>
code and comes back when I add it back in.
What am I doing wrong?
EDIT: I', guessing that this is somehow related to performance/time to render and time steps since I'm getting the same weird disappearances etc when trying to add any other complex effects e.g. from react-three/postprocessing. Still no idea how to solve it though.