Camera Collision with FirstPersonCamera #424

willcrichton opened this Issue Aug 14, 2011 · 1 comment


None yet

2 participants


I'm trying to use the collision utilities so that the camera will collide with some Box geometries that I have. I've successfully added the Boxes to the colliders list, but the trick is I don't really know how the collision is supposed to work. I figure that you'd probably want to overwrite THREE.Camera.prototype.translate. I took a look at some of the collision examples, but most of the stuff with rays and projection just went way over my head. I figured something like this would be a great example to include with the default package.

So, my question is: how can I overwrite the camera's translate method such that it will check for any blocks in the path of movement, and then prevent the camera from moving into a block in its path?

mrdoob commented Aug 14, 2011

I don't think you need to overwrite anything. You know in which direction the camera is going, right? Most likely: - camera.position. So using that vector you can throw a ray into the scene and check if it's colliding. I haven't used CollisionSystem yet thiough, I would use Ray myself.

@mrdoob mrdoob closed this Aug 29, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment