Recommended Posts

I''m working in VC and DX8 and I''m having a 3d scene where I can move my camera over and around a terrain, the thing is that I wish to keep a constraint on my camera so that I cannot move it out of the boundaries of the terrain. The thing is that I''m not using a heightmap or skybox.

0

Share this post

Link to post

Share on other sites

Do an Inverse on the camera (view) matrix to get its location in the world. If its outside the boundary, set the position inside the inversed view matrix to be the boundary (the position is at _31, _32, _33, being x,y,z). Then inverse the camera view matrix again and set that as being the camera view matrix.