This commit is contained in:
Vasyl Kazakov
2026-05-28 18:35:39 +03:00
parent aefe01860e
commit 2633be60a1
18 changed files with 5545 additions and 109 deletions
+32
View File
@@ -0,0 +1,32 @@
import { Object3D } from "three";
import { ThreeC } from "../ThreeC";
import { PhysicsBody, PhysicsLayer } from "../PhysicsC";
export class Map {
static Init() {
const mapObject = ThreeC.getObject("map");
if (!mapObject) {
console.warn("Map model resource not found: map");
return;
}
mapObject.position.set(0, 0, 0);
ThreeC.setShadowsStateForChildren(mapObject, true, true);
ThreeC.addToScene(mapObject);
const colliders = mapObject.getObjectByName("Colliders");
if (colliders) {
colliders.visible = false;
this.buildColliders(colliders);
}
}
private static buildColliders(collidersRoot: Object3D) {
collidersRoot.traverse((child) => {
if (child === collidersRoot) return;
if ((child as any).isMesh) {
new PhysicsBody(child, false, 0, PhysicsLayer.Wall, PhysicsLayer.Player);
}
});
}
}