Collision with camera view

lavitz used Ask the Experts™

I have problems with making collision with camera bounds. I know that there is no camera bound in opengl so how to make collision with camera view?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Calculate a plane for each side of the view and detect whether the geometry is in front of those planes.

The math for calculating the planes involves the field of view and the size of the viewport.  I've seen a few people use glUnProject to get the sides of the view as points in 3D space, then use those points to calculate the planes.  That works fine, its easier to understand than the direct math.  Slightly slower, but it only happens once per frame.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial