better collisions

This commit is contained in:
2023-06-27 18:50:09 +02:00
parent f582e68d89
commit eb3ae6f00c
2 changed files with 12 additions and 13 deletions

View File

@@ -1,10 +1,12 @@
import * as THREE from 'three';
const mazeGeometry = new THREE.BoxGeometry( 1, 1, 1 );
export default class MazeMesh extends THREE.InstancedMesh {
constructor( width, length, material ) {
super( mazeGeometry, material, width*length - 2 );
constructor( width, length, height, material ) {
super(
new THREE.BoxGeometry( 1, height, 1 ),
material,
width*length - 2
);
this.length = length
this.width = width
this.map = new Array(length).fill().map(() => new Array(width).fill(1))