Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Svelte App #108

Open
JayJayBinks opened this issue Aug 13, 2024 · 3 comments
Open

Error in Svelte App #108

JayJayBinks opened this issue Aug 13, 2024 · 3 comments

Comments

@JayJayBinks
Copy link

JayJayBinks commented Aug 13, 2024

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;})}}>

@JayJayBinks
Copy link
Author

Duplicate of #74 .
I was also using hide() and show().
Lets see if removing it fixes the issue.

@frankieali
Copy link
Contributor

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.

@JayJayBinks
Copy link
Author

After removing the hide/show i did not get this error anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants