C++, DirectX9, collision with .x terrain?
Hello. I've been searching on Google but haven't managed to find, how to detect collision between .x model (either it's position) and .x terrain. I think it has something with getting height of terrain at X, Y coordinates, but I'm not sure how. Maybe anyone could help?
There isn't a collision detection system built into DirectX or C++.
You can consider one of the D3DXIntersect functions to determine the relative positions of one mesh with another. If you're strictly interested in height-above-terrain that would be your best bet.
Otherwise you may want to use one of several collision/physics engines available around the web (Havok, Bullet, ODE, etc.).
You can consider one of the D3DXIntersect functions to determine the relative positions of one mesh with another. If you're strictly interested in height-above-terrain that would be your best bet.
Otherwise you may want to use one of several collision/physics engines available around the web (Havok, Bullet, ODE, etc.).
Well thanks for reply
Appears rotation of terrain didn't apply when detecting collision, so it wasn't right, after rotating model in editor, not in code it became all fine.
Thanks again
Appears rotation of terrain didn't apply when detecting collision, so it wasn't right, after rotating model in editor, not in code it became all fine.
Thanks again
Still, you should read all the height data from the model and store it in a local vector/array, to avoid having to read from agp memory :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement