• Advertisement
Sign in to follow this  

Collision detection

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

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:)

 

 

Share this post


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

 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.

Share this post


Link to post
Share on other sites

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.

Edited by adriansnetlis

Share this post


Link to post
Share on other sites

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).

Share this post


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

  • Advertisement