Fix dice roll calculation
This commit is contained in:
parent
4983ddbc17
commit
0113b07ac4
@ -16,7 +16,13 @@ import d100Source from "./shared/d100.glb";
|
|||||||
|
|
||||||
import { lerp } from "../helpers/shared";
|
import { lerp } from "../helpers/shared";
|
||||||
import { importTextureAsync } from "../helpers/babylon";
|
import { importTextureAsync } from "../helpers/babylon";
|
||||||
import { InstancedMesh, Material, Mesh, Scene } from "@babylonjs/core";
|
import {
|
||||||
|
AbstractMesh,
|
||||||
|
InstancedMesh,
|
||||||
|
Material,
|
||||||
|
Mesh,
|
||||||
|
Scene,
|
||||||
|
} from "@babylonjs/core";
|
||||||
import {
|
import {
|
||||||
DiceType,
|
DiceType,
|
||||||
BaseDiceTextureSources,
|
BaseDiceTextureSources,
|
||||||
@ -97,14 +103,14 @@ class Dice {
|
|||||||
) {
|
) {
|
||||||
let instance = mesh.createInstance(name);
|
let instance = mesh.createInstance(name);
|
||||||
instance.position = mesh.position;
|
instance.position = mesh.position;
|
||||||
for (let child of mesh.getChildMeshes()) {
|
for (let child of mesh.getChildTransformNodes()) {
|
||||||
const locator = child.clone(child.name, instance);
|
const locator = child.clone(child.name, instance);
|
||||||
if (!locator) {
|
if (!locator) {
|
||||||
throw new Error("Unable to clone dice locator");
|
throw new Error("Unable to clone dice locator");
|
||||||
}
|
}
|
||||||
locator.setAbsolutePosition(child.getAbsolutePosition());
|
locator.setAbsolutePosition(child.getAbsolutePosition());
|
||||||
locator.name = child.name;
|
locator.name = child.name;
|
||||||
instance.addChild(locator);
|
instance.addChild(locator as AbstractMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.physicsImpostor = new PhysicsImpostor(
|
instance.physicsImpostor = new PhysicsImpostor(
|
||||||
|
Loading…
Reference in New Issue
Block a user