Open JayJayBinks opened 3 months ago
Duplicate of #74 . I was also using hide() and show(). Lets see if removing it fixes the issue.
If mesh face is -1 that usually means the die has left the scene and been culled. This can happen when the dice are thrown with a high enough force to go through the dice-box walls. It also sometimes happened when the dice are too big for the box they're in. Let me know if removing hide/show methods works. I'll have to set up a testing sandbox to see if I can recreate the issue.
After removing the hide/show i did not get this error anymore.
Error
Initially the dice roll fine but after a while i get this error
colliderFaceMap Error: No value found for d20 mesh face -1
After reloading everything works again, for a while.
Setup
SvelteKit App with 3d-dice as npm dependency
I have a Tailwind dice box at top level:
<div id="dice-box" class="fixed inset-0 w-screen h-screen z-30 pointer-events-none"></div>
On document ready i initialize it and everything works fine:
diceBox = new DiceBox("#dice-box", { assetPath: "/assets/dice-box/", // required }); diceBox.init();
<button id="roll-dice-button" class="btn btn-ghost m-3 " disabled={rolledValueState.value} onclick={(evt) => {diceBox.show(); diceBox.roll("1d20").then(results => {rolledValueState.value = results[0].value;})}}>