September 22nd, 2009, 01:24 PM
How to know if camera is looking at object?
i am working on a 3D flight simulator game that is based on the 3DVU engine.
I have created 3D objects in my game, which are cut-in-the-center cubes meant to be flown through as a highway in the sky, which float around the world that I have. I have control over the camera viewing the world and the objects.
What I am currently trying to do is to have the ability to move the mouse over an object on the screen of the game and to be able to click on them and drag them around.
Before I get to the dragging part, I need to know when the mouse is over the object.
I have a 3d vector space where I know the 3d vector position of the object and of the camera. I understand that I could use something called "Ray Tracing" in order to figure out if the camera is looking at the object, or if the object is on screen. I found alot of websites about ray tracing, but I understood those were more about for rendering, not for figuring out if there's just an intersection.
I've also been told that I should mark my objects in a bounding box, using two positions of the objects (minimum and maximum vector points) to define the bounderies.
I am confused as how am I supposed to work with ray tracing to figure out if the object is inside the camera's view, or is in the center of the camera's screen.
Thanks in advance.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!