Jump to content
  • Advertisement
Sign in to follow this  
TempusElf

Accurate collision between animated models

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

Are there well known and practical methods for getting collision detection between two animated models/meshes down to the polygon level? I know that I could easily keep models from walking into each other by using bounding volumes... However, If I then want to go to the next level and see if the polygons are actually colliding I can't think of how I would go about doing that... My initial thought was to just test for intersection between the models as they are shaped right now as if they were not moving. But it seems to me that this is very dangerous because the models could potentially change shape enough during that frame that the resulting collision response looks ridiculous. The reason I ask this question is because in the game I'm planning to work on, I want the characters to engage in close combat. So, if I have two characters in a fist fight or a sword fight, I want to be able to accurately see if the fist hit the enemy or if the sword hit a shield... How might this be done?

Share this post


Link to post
Share on other sites
Advertisement
If it's just for a game then you realy don't need that accurate collision detection (too expensive). Just try approximate each part of the model/mesh with one or more capped cylinder(s) or sphere(s) and use them for the collision detection.

For instance you could use a capped cylinder between the knee and ankle and a sphere as a foot. If you need more accurate collision detection than that then just use, say a few more spheres as toes (you get the point)

Capped cylinders and sphere are both easy to transform along with the animation as the only consist of one or two points with a radie.

Share this post


Link to post
Share on other sites
For a fighting game collision primitive hierarchy are often used... As suggested earlier, a hierarchy of cylinders, spheres linked to the character skeleton works wonders.
Polymesh versus polymesh is not easy and animated polymesh is even more difficult. Since a fighting game requires you not to miss collisions you'd probably have to perform swept tests too. I'd stick with collision primitives [smile].

Note: Swords will most certainly require swept tests in order not to miss too many collisions.

Share this post


Link to post
Share on other sites
I have been considering spheres and AABBs, but what are cylinders? Can they be used in swept tests? How to collide them with spheres and AABBs?

Perhaps what I am looking for is further reading on cylinders for collision representation. Could you provide some links please?

Thanks in advance!

Share this post


Link to post
Share on other sites
That should be capped cylinders. Think of it as a pipe with a sphere at each end.

Sphere - Capped Cylinder Collision
Sphere { point, radie }
CCylinder { pointA, pointB, radie }

1. get the point on the (CCylinder)pointA-PointB line segment that is closest to (Sphere)point.

2. if (Sphere + CCylinder) radie is greater or equal to the distance from that closest point to (Sphere)point then there is a collision.

(step two can be done a little faster if you use distance² (no sqrt()) and the (Sphere + CCylinder) radie² for the test)

Swept tests should be quite simple too.

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!