Direct3D IM object picking
we are havin the same problem as well!
if ya find a way out pls let me know at sandeep_kl@mailcity.com
if ya find a way out pls let me know at sandeep_kl@mailcity.com
Raptor
Hi,
here''s a short algorithm for picking objects
1. Compute a ray with the origin in the camera position
2. Pick the object that this ray intersect closest to the camera
The keywords here are ''ray'' and ''intersect''.
The ray''s direction is computed by unprojecting a screen coordinate by multiplying it with (ViewMatrix*ProjectionMatrix*ViewportMatrix)-1 and then subtracting the camera''s position from the result.
Then you check for all objects if the ray intersect any of their triangles. Then finally you pick the objects which was intersected the closest to the camera.
You can find info on how to check if a ray intersects a triangle here: Fast ray/triangle intersection test
- WitchLord
here''s a short algorithm for picking objects
1. Compute a ray with the origin in the camera position
2. Pick the object that this ray intersect closest to the camera
The keywords here are ''ray'' and ''intersect''.
The ray''s direction is computed by unprojecting a screen coordinate by multiplying it with (ViewMatrix*ProjectionMatrix*ViewportMatrix)-1 and then subtracting the camera''s position from the result.
Then you check for all objects if the ray intersect any of their triangles. Then finally you pick the objects which was intersected the closest to the camera.
You can find info on how to check if a ray intersects a triangle here: Fast ray/triangle intersection test
- WitchLord
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement