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

D3DXIntersect with moving objects problem

Started by Raeldor Aug 30, 2003 at 11:33 AM 2 replies 300+ views
Original Post
Raeldor
Raeldor
Hi all, I am testing for collision detection using the D3DXIntersect function, but cannot get it working properly. Does anyone know if this function takes into account the current world matrix setting? If not, does this mean I have to translate my mesh (or my intersection ray?) by the scaling/position/rotation that I would normally apply before rendering the object? Thanks Rael
VolkerG
VolkerG
I wouldn''t transform the mesh, but the ray by the inverse transform matrix.
Raeldor
Raeldor
Thanks for your reply, but still no luck yet. I am passing in the near and far points of the ray, then doing a matrix invert on the matrix that I use to position/scale/rotate the mesh. I am then transforming the near and far points of the ray by this inverted matrix, then calculating the direction from near-far. I then use the inverted near point, and the new direction vector to check the intersection of the mesh.

Does this sound right? Am I missing something?

Thanks

Rael
Raeldor
Raeldor
My bad, I was deducting near from far instead of far from near... it works!!! yea!

Thank you!

Topic Locked

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

Sign in to reply to this topic.