Jump to content
  • Advertisement
Sign in to follow this  

Ray Tracing problem, probably obvious :)

This topic is 3717 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Right, i'll get straight to the point :) basically i've to make a 3d game using C++ and OpenGL. my camera is just a basic 1st person camera and i've got a cube for a room. i've got a flat door on one of the walls, and i want my cross hair to change to a "open door" symbol when the camera forward vector intesects with any point on the door and i'm in range of the door, for now assuming the range is 1 for simplicity. i've got the ray tracing formula to be: x1 + x2*t = x3 + x4*u + x5*v y1 + y2*t = y3 + y4*u + y5*v z1 + z2*t = z3 + z4*u + z5*v with the left side of the equations being the camera position + the forward vector multiplied by t, and the right side of the equation being the object bottom left when u and v are 0, and the object top right when v and u are 1. i need to find t(as its the the "range" check, want to question if its below 1) and the only way i can see to do this is to simply perform the check over and over with u and v increased in small incriments between 0 and 1, however this would mean a rediculious amount of checks required specially given i wont only be having one door in the game lol. basically i've used this forum quite a few times before and found the answers i needed without having to post, but i cant find anything to help me here(unless i'm just being incompitant). i'm hoping someone can point out something obvious i'm missing or, possibly a more logical way of doing this :) Edit: btw, the problem here is the ray tracing, the cross hair thing, thats just to give context of what i'm doing. Thank you in advance, AzCopey [Edited by - AzCopey on March 17, 2008 6:04:24 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!