Public Group

Collision help

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

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 on other sites
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 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 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 :)

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 14
• 45
• 22
• 27
• Forum Statistics

• Total Topics
634044
• Total Posts
3015210
×