i came across a functionality in OpenSceneGraph, using which, i can find the intersection of a line with a rendered terrain(or any object in the way of the line’s path), and with that approach i can find the heights of all points of the terrain.Basically the height of the terrain is where the line intersects the terrain.
i am curious as to how i can implement this on my own. Can anyone please suggest me how i can go about it?
i wish to do all the calculations on my own. Is there any way i can go about it?
So, what i can do is, shoot a ray, placing the object at a known position and find the intersections?
Uhm, you kinda lost me, what are you actually trying to do (your original question suggested you wanted the height of some terrain at a given position)?
Nevertheless the above sounds a bit backwards to me, it’s more like: shoot a ray, find the intersection and place the object at the intersection point – that assumes your goal is to place an object in an existing scene.
Uhm, you kinda lost me, what are you actually trying to do (your original question suggested you wanted the height of some terrain at a given position)?
Nevertheless the above sounds a bit backwards to me, it’s more like: shoot a ray, find the intersection and place the object at the intersection point – that assumes your goal is to place an object in an existing scene.
im sorry, i was trying to explain the situation with the terrain example. It could be any object. i was just trying to know the Math behind these calculations. i found some links on Ray Tracing.