If everything is cube sized/2 dimensional, use a tile grid for collision
On Jan 6, 1:44 pm, dyc <[email protected]> wrote: > Hey everyone, > > I've been building this 3D room out of cubes for the walls and floor > and roof...now I have my camera moving around inside of the room with > the mouse and keyboard, but I dont want the camera to be able to go > thru the 4 walls. > > Each wall is a different Cube Object...and I am doing movement via > camera.moveForward(distance)... > > any ideas on what would be the easiest approach? > > I was thinking about doing something like: > > if(camera.distanceTo(_backWall) < MY_MAX_DISTANCE){ > camera.moveForward(distance); > > } > > only problem is, that is not dynamic, and as the user moves around the > moveForward will be pointing at a different wall and I will need to > detect the distance to it with a different if statement.. > > Thanks so much! > > `Scott
