Deterministic Dice Roller with react-three-fiber

348 views Asked by At

I found this great example of creating 3D dice with react-three-fiber at https://codesandbox.io/s/reverent-lalande-5qdk4j. I want to do something similar but with deterministic rolling, meaning I can create multiple dice, set their initial position, angle, velocity, and when they stop moving each die has exactly the number I chose beforehand facing up. I've seen this done by dice-box-threejs (https://codesandbox.io/s/dice-box-threejs-j79h35 and https://github.com/3d-dice/dice-box-threejs/tree/main/src), so I know it is possible, but that is threejs outside of React and I've had no luck getting it to work inside React... which is what led me to react-three-fiber. Is there a way to use dice-box-threejs directly in React or would it somehow have to be re-built from scratch using r3f?

1

There are 1 answers

0
PartialFlavor_55KP On

Answered here by drcmda: primitive object for Vanilla <primitive object={...} />