This commit is contained in:
2025-11-24 08:27:04 +02:00
parent c67ffd774b
commit 3678ad0cfb
5 changed files with 28 additions and 22 deletions
@@ -1,8 +1,9 @@
import { bottomOrigin } from "@/lib/MeshUtils";
class CharacterObject{
constructor(engine, data){
return new Promise(async(resolve, reject)=>{
this.source = await engine.load(data.$go.asset.name);
this.object = this.source.scene;
this.object = bottomOrigin(this.source.scene);
resolve(this);
})
}
@@ -145,7 +145,7 @@ class MazeObject {
});
this.mazeObject(def, room);
let floorSize = { width: (bbox.r - bbox.l + 10*scale)/2, height: 0.01, depth: (bbox.f + 10*scale)/2 }
let floorSize = { width: (bbox.r - bbox.l + 10*scale)/2, height: 1, depth: (bbox.f + 10*scale)/2 }
const floorGeometry = new PlaneGeometry(floorSize.width*2, floorSize.depth*2);
const floor = new Mesh(floorGeometry,new MeshStandardMaterial({
roughness: 0, metalness:1, color: 0x00ffff, side: DoubleSide
@@ -155,7 +155,7 @@ class MazeObject {
root.add(floor);
let pf = engine.physics.add({position: floor.position}, 'fixed', false, undefined, 'cuboid', floorSize)
//pf.collider.setRestitution(0);
//pf.collider.setTranslationWrtParent({x:0, y: -100, z:0})
pf.collider.setTranslationWrtParent({x:0, y: -floorSize.height, z:0})
}
}
}