Am Tryning to make that my character dont go inside my glb model of map, I saw this : https://threejs.org/examples/#games_fps and tried using the octree but getting an error if someone can help me setup collisions and if I need to setup something in my map file.
My map loader code :
const worldOctree = new Octree();
export function setupLevel(scene) {
const loader = new GLTFLoader();
loader.load(
"../../models/level.glb",
(gltf) => {
scene.add(gltf.scene);
worldOctree.fromGraphNode(gltf.scene);
gltf.scene.position.y += 0.1;
const helper = new OctreeHelper(worldOctree);
helper.visible = true;
scene.add(helper);
},
(xhr) => {
console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
},
(error) => {
console.error(error);
}
);
return worldOctree;
}