[cannon.js] How fasten physics box?

The box should be affected by gravity.

However, the z-axis should not change.

I want falling box, like a firefighter & rod stock.

Please help me.


react example: https://codesandbox.io/s/r3f-cannon-instanced-physics-g1s88?file=/src/index.js

Yes that’s doable. You can have the box affected by gravity while keeping its z-axis fixed by constraining its movement along that axis in the physics body. In Cannon (or @react-threereact-three/cannon), you can set the linearFactor of the body to (1, 1, 0) so it moves freely in x and y but ignores z. That way it falls naturally like a firefighter sliding down a pole but doesn’t drift along z.