Terrain collision c++ directx9

Started by
2 comments, last by Buckeye 13 years, 1 month ago
Ok i have been trying to find a tutorial or sample that can help me but no luck. I have an .x file that represent my terrain and .x file that represent my object that will be walking on terrain. The problem is how do i detect collision. my terrain an't that big so i can do triangle test but how?! DON'T TELL ME ABOUT TOYMAKER BECAUSE THERE TUTORIAL USES .RAW AND IM USING .X. sample or tutorial that would be helpful.
Advertisement
Take a look at the D3DXIntersect function.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

i have used D3DIntersect for picking. How am i suppose to use it for an object?[color=#CCCCCC][size=2]
You can use a ray position somewhere above the terrain at your object's location, and "shoot" the ray (set the ray direction) downward to get the distance to the ground.

E.g., your object's pelvis position is 3 units above it's feet. Shoot a ray down from the pelvis position. If the distance is greater than 3 units, the object is "in the air" and will "fall." If the distance is less than 3 units, raise the object's pelvis to a position 3 units above the ground.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement