From 0113b07ac466cdfa665a032501d3e4b2a2aefc8f Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sun, 18 Jul 2021 09:50:50 +1000 Subject: [PATCH] Fix dice roll calculation --- src/dice/Dice.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dice/Dice.ts b/src/dice/Dice.ts index 0264711..f984bd5 100644 --- a/src/dice/Dice.ts +++ b/src/dice/Dice.ts @@ -16,7 +16,13 @@ import d100Source from "./shared/d100.glb"; import { lerp } from "../helpers/shared"; import { importTextureAsync } from "../helpers/babylon"; -import { InstancedMesh, Material, Mesh, Scene } from "@babylonjs/core"; +import { + AbstractMesh, + InstancedMesh, + Material, + Mesh, + Scene, +} from "@babylonjs/core"; import { DiceType, BaseDiceTextureSources, @@ -97,14 +103,14 @@ class Dice { ) { let instance = mesh.createInstance(name); instance.position = mesh.position; - for (let child of mesh.getChildMeshes()) { + for (let child of mesh.getChildTransformNodes()) { const locator = child.clone(child.name, instance); if (!locator) { throw new Error("Unable to clone dice locator"); } locator.setAbsolutePosition(child.getAbsolutePosition()); locator.name = child.name; - instance.addChild(locator); + instance.addChild(locator as AbstractMesh); } instance.physicsImpostor = new PhysicsImpostor(