Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

ray tracing when object moved

Started by rockskull Nov 17, 2004 at 8:35 AM 1 replies 350+ views
Original Post
rockskull
rockskull
The DX9 SDK Picking tutorial seems to only deal with situations when objects are not moved. I'm using functions from the CD3DArcBall() (sample platform) to manipulate object, when trying to integrate the picking functions, it seems the transformation matrix does not work after the object is moved. Would anyone describe: 1. Relationships between view point vector, ray direction vector, object centre. 2. When to use translation and rotation matrix under the situation that the same mouse button is used for both model manipulation and picking (is there possible conflict here that needs 3. Does it matter part of the world transmation has been done by quaternion when doing ray tracing? (the CD3DArcBall() class uses quaternion for axis to axis rotation) 4. How to determine whether a vector needs to be further transformed, and what matrix to use.
rockskull
rockskull
I know this is a bit stupid, but I just found the answer to my question myself.

The picking sample from the SDK is good enough, just make sure that whatever you do with the world matrix during model preparation, remember to undo the world transformations when do picking.
rockskull
rockskull
Forgot to mention, it doesn't matter whether quaternion was used for transformation or not when translating screen coordinate back to 3D space, GIVEN that the quaternion was transformed back into a 4x4 matrix which is then used for transformation in the first place. Just save the inverse of this quaternion translated matrix, this is what we want for rewind the transformation when picking.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.