Sign in to follow this  

Shape casting a capsule against a convex polyhedra

Recommended Posts

Let's say I have a upright capsule shape (swept sphere) that I would like to cast it along a velocity vector. I would like to be able to find the [b][i]point of contact[/i][/b] and a [b][i]surface normal[/i][/b] for any convex shapes it would intersect along this path. I would also like to find the distance the swept caspule traveled to the point of first contact.

Heres a quick diagram of a capsule being casted against a large convex polyhedra (only one face is drawn) [img][/img]

What kind of algorithm or process could do this? I assume it would be similar to a sphere-cast, but i can't find much on that either.

Share this post

Link to post
Share on other sites
You'll need to google for Minkowski Difference.

In short the convex shape grows by the shape of capsule, and the capsule shrinks to a single point at the origin, then the test simplifies to a point vs convex object test.

If you want time of intersection, you shoot a ray from the origin along the velocity of the object, the point of intersection and normal on the Minkowski Difference are the things you are after :)

You can see how it all works here:



Cheers, Paul.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this