Jump to content
  • Advertisement
Sign in to follow this  
ramilolz

Terrain collision c++ directx9

This topic is 2655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!