Jump to content
  • Advertisement
Sign in to follow this  
cnboy0212

help on concave!

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

I learned how to do collision detection for 2D concave shapes by checking if the points of one concave shape is inside the other one, or turning the concave shapes into triangle and then check if they are colliding,but i got stuck when i try to figure out the penetration the collision. I have been asking this question everywhere and searching for solution,but havent got anything. hopefully this place can help, thanks~

Share this post


Link to post
Share on other sites
Advertisement
If you use the separating axis theorem method on the triangles to check for collisions then it should return the projection. If your checking point inside polygon you'll have to loop through the edges of the containing polygon and find which one is closest to the penetrating point and then the vector from the point to that edge is the projection necessary.

Share this post


Link to post
Share on other sites
oh i just thought of a question too,what happen if 2 concave are colliding but none of their points are in the other shape? how you check it if you are using the point in polygon method?

Share this post


Link to post
Share on other sites
Quote:
Original post by Alrecenk
If you use the separating axis theorem method on the triangles to check for collisions then it should return the projection.


i thought of it too,but SAT return the smallest projection,but what happen if the the smallest projection is not the edge of the polygon,and its between 2 triangle that created from the triangulation? and it will just keep moving back and forth between those 2 triangle

Share this post


Link to post
Share on other sites
You can decompose concave polygons into a collection of convex ones, then test as usual for them. There are also algorithms for detecting point-in-poly for concave if you dont want to do that.

Quote:

oh i just thought of a question too,what happen if 2 concave are colliding but none of their points are in the other shape? how you check it if you are using the point in polygon method?


This will only happen if your time step is large and a point goes all the way through a body and out the other side. If you keep your timestep low and your objects and fat this wont happen much. It will only happen with really thin objects. If you must, you can do line-poly intersection tests to see if it intersected over the course of the time step for each point, but this is slow.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!