Collision detection

Started by
14 comments, last by adriansnetlis 7 years, 10 months ago

Hello!

I need to detect collisions between objects.

What I have(for both colliding) is:

  • vertices(position, index, mass, velocity, net force from springs)
  • edges(an array of 2 vertex indexes), includes inner edges in cases of volumetric objects(used to prevent deflection)
  • surfaces(an array of 3 vertex indexes, they can be used to obtain the normal firction of surface, I think)

I need to find out:

  • If the vertex is colliding with surface
  • How deep the vertex has gone through the surface in case if it is colliding
  • How much force and in which direction the vertex needs to have applied in order get on the surface

I'm working in 3D space.

I know that this is all a complex piece of maths and physics, but I really need this. It would be good if I could get all of this information at an easy to understand form. I also need all of those equations. Actually what I really need is to find out the normal force of contact. However, this requires to detect contact first. I hope that you can help me somehow:)

Advertisement

  • If the vertex is colliding with surface
  • How deep the vertex has gone through the surface in case if it is colliding
  • How much force and in which direction the vertex needs to have applied in order get on the surface

Very often verticies do not penetrate/collide, and there is collision, consider two long boxes hitting in their midles, a single vertex isn't involved.

There are multiple ways of handling collision responses, and multiple ways of what collision data is detected.

In programming there isn't a universal physique engine/logic, physique engines target certain usages, or , combine them in case of more bigger framework (rigid mechanics, liquids, cars etc.). So if you describe your custom situation and usage, you may get more proper advices.

My custom situation and usage is softbody simulation. Each vertex is a node, each edge is spring. Each polygon is just a surface that another node can hit. In case if the surface gets hit, it should apply normalforce to all 3 of it's vertices. Each of them, though, must receive a force proportional to the distance to the point. That could be handled, I think.

Each polygon is just a surface that another node can hit. In case if the surface gets hit, it should apply normalforce to all 3 of it's vertices. Each of them, though, must receive a force proportional to the distance to the point. That could be handled, I think.

This is then a great case for barycentric coordinates on a triangle. It is then three umbers that sum to 1.0 and they explain "weight" of every vertex for arbitary point in triangle (it is the same principle as interpolators in triangle rasterization in pixel shader function), you can then interpolate any attribute of the verticies, whaether 2d vector, 3d vector etc.

OK! But how do I detect hollisions? How to test if a vertex(node) has colliden with the triangle? Is it somehow possible?

OK! I've found some resources about triangle intersection and I may use them. However, how do I find out which vertices of triangle has gone through the other triangles, but which ones haven't? Is there possible check?

Edit. Hm... Possibly I must store the previous side where triangles was. And if the vertex is now in other side relative to the triangle, than it's colliding.

Hello? Anybody? I need to detect inter-triangle collision. Help!

Whenever I have a "how do I check for intersection/collision between a [thing] and [another thing]" I go here:

http://www.realtimerendering.com/intersections.html

Bookmark that! You're welcome.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

Wow, thanks. This seems like something great!:)

By the way would this type of detection if vertex has gone through the triangle work be correct?

Find on which side of the plane of the collision triangle the vertex was in last frame. If it was the other side, than the vertex has gone through. At this time apply force to get it back and ensure that it is where it should be. Replace the "last frame side" by the new position(so that it doesn't oscillate between sides).

This topic is closed to new replies.

Advertisement