Jump to content
  • Advertisement
Sign in to follow this  
Wybiral

Collision help

This topic is 4500 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

Can anyone help me make a collision detection routine that works per face. All of my models are triangulated if that helps. I guess what I am asking is can someone show me how to find the intersection of a line and a triangle. The line will be... (x, y, z) to (NewX, NewY, NewZ). The triangle can be defined as (tx1, ty1, tz1)-(tx2, ty2, tz2)-(tx3, ty3, tz3). My old system of collision works with bounding boxes... But I am unhappy with it. I want to use collision detection on models and make the ground deformable, and bounding boxes just dont cut it. Also, another possibility would be... How can you find the distance from a face based on those values... I have found plenty of info on distance from a line... But what about distance from a triangular polygon? This collision detection if intended for use with the player in a game engine I am working on. I also have the vertex normals of the faces if that helps, and I could find the face normals if needed. Any help will be appreciated, if useful, even credited as a contributer to my engine. THANKS!!! I appreciate you guys taking your time to help me with this.

Share this post


Link to post
Share on other sites
Advertisement
I suggest you to give a try to either coldet or Opcode. Both are free library (the license of opcode is more liberal than coldet's license).

For the formula that will give you the distance from a point to a plane can be found here. This PDF from Dave Eberly gives you an algorithm to find the distance from a point to a triangle.

BTW, google is teh big win [smile].

Share this post


Link to post
Share on other sites
Hmm, thank you for responding so quickly, but I am not using C++, I am using basic4gl. I have the majority of an engine built... But the collision detection isn't all that great. If you could help me in terms of the variables I mentioned and give me some raw equations that would be great. But, like I said... I do appreciate your responding.

Share this post


Link to post
Share on other sites
Since collision detection is fairly intensive, you may experience some problems if you try to implement a precise coldet scheme using basic4gl. I suggest you to go through the road of hierarchical bounding volumes (spheres work great, but you can also work using oriented bounding boxes).

Pointers:
Advanced Collision Detection Techniques (might require a free registration)
Practical Collision Detection
Simple Bounding-Sphere Collision Detection
Collision Detection, Part 1: Using Bounding Spheres

There is a lot of available pointers everywhere around the net - you'll also find a lot of collision detection based questions on these forums.

Good luck in your implementation :)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!