Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / Triangle Collision Detection Bug?

Author
Message
destroy89
17
Years of Service
User Offline
Joined: 27th Jan 2007
Location:
Posted: 15th Jun 2007 22:37
Ok. Long code segment. I'm trying to use collision detection on 2d dimensional 3d rendered triangles in the same plane (no Z is used). Try my code. Can you explain why it doesn't collide properly? It switches from default to poly based detection halfway through.

Is this a bug in dark basic? Should I try it with objects that have a dimension in the Z axis?

See code...


destroy89
17
Years of Service
User Offline
Joined: 27th Jan 2007
Location:
Posted: 21st Jun 2007 17:54
Has anyone managed to perform collision detection properly on angled objects like triangles?

I want to be able to detect collisions like the image below, but when I use "set object collision to polygons <object #>" on both objects, the collision is detected far too late. If I use boxes based detection then it will detect too early. If I have one object set to boxes and the other to polygons, then it detects collisions properly for the one, but not for the other. Do I have to purchase plugins to have proper collision detection of polygon based objects?

DSG
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Hampshire, England
Posted: 21st Jun 2007 19:44
3D triangle-triangle intersection tests generally begin with a ray-plane intersection test using triangle edges.

The ray-plane intersection test relies on classifying each end-point of an edge (belonging to one triangle) to the plane that the other triangle lies in. The logic being that, if one edge vertex is behind or coincides with the triangle plane and the other vertex is in front or coincides with the triangle plane then a collision may have occurred.

Unfortunately, since your triangles all coincide on the same plane, the intersection algorithm is more likely to return incorrect results due to floating point precision errors when calculating the distance between each edge vertex and the plane (the distance values are important for determining intersections).

This is the likely cause of your collision detection issues. Additionally, the algorithm that DBP employs may not even consider coinciding triangles as colliding.

This isn't really a fault of DBP. Your best bet is to use some intersection tests designed specifically for 2D lines/triangles (either write your own or try searching this forum for existing implementations).

Danny Gregory BSc
destroy89
17
Years of Service
User Offline
Joined: 27th Jan 2007
Location:
Posted: 21st Jun 2007 20:47 Edited at: 21st Jun 2007 20:49
Excellent. Very geometric answer. Does it help if I am rendering the 2d shapes with 3d objects so they have depth to collide with as well? [edit] I am currently testing with vertex modified cubes. DBP still has issues detecting collision this way.

I am probably going to use Nuclear Glory plugin to do it. Forgot I had it.

It is nice to know whether or not DBP can do it or why it can't though.

Login to post a reply

Server time is: 2024-05-18 23:51:19
Your offset time is: 2024-05-18 23:51:19