   Separating Axes to Test in Capsule Collision
  I'm not sure which axes to check in capsule collision using separating axis. I know spheres use the point closest to the shape but capsules seem to be a little more different than I thought.I could probably come up with somethng bloated that could work but as I'm assuming there's a relatively simple approach.   
  Are you talking about capsule-vs.-capsule, or capsule vs. some other shape?[Edit: You did say 'point closest to the shape', so I'm guessing it's capsule vs. other shapes. Which shapes specifically do you have in mind?]   ;  Currently I want to try it against triangles. I thought testing against other shapes would be pretty similar in implementation. It has been for boxes and spheres at least.   ;Quote:I know spheres use the point closest to the shape but capsules seem to be a little more different than I thought.Are you talking about the point that will be the intersection point on the sphere if moved in a certain direction (closest point on the sphere to the triangle)? If so, the same goes for the capsule I think. Find the closest point on the capsule to the triangle.   ;  Are you talking about 2D or 3D?   ;Quote:Are you talking about the point that will be the intersection point on the sphere if moved in a certain direction (closest point on the sphere to the triangle)? If so, the same goes for the capsule I think. Find the closest point on the capsule to the triangle.That's what I was thinking. Maybe I'm doing something wrong. Could it be my projection method?public void Project(Vector3 axis, out float min, out float max)   {  float c0 = Dot(axis, Center - Up * HalfLength);  float c1 = Dot(axis, Center + Up * HalfLength);   min = Min(c0 - Radius, c1 - Radius);  max = Max(c0 + Radius, c1 + Radius);    }Quote:Are you talking about 2D or 3D?3D   ;  Well so far I've mananaged to get results with...1. axis of the closest points between the capsule and triangle2. the triangle normal3-5. the cross product of the capsule up vector and each triangle edgeI haven't tried "rotating" the capsule yet but so far so good. Update:Well it works, though I haven't had much test time! It's more expensive than a sphere than I thought it would be though.My nearest point code involves finding the nearest point between the center line of the capsule and each line on the triangle. Which feels very expensive. Other than that, everything seems about right.If anyone has suggestions to improve on this or sees an error, feel free to say so.[Edited by - AntiGuy on May 24, 2010 10:47:03 PM];  Okay I'm assuming you're doing a collision sweep test, you check the nearest intersection point, cast that on the triangle plane and use reverse intersection to determine the actual point of intersection. If so, one thing that comes to mind is that for a capsule the nearest point of intersection (or at least one of them since it can be an infinite amount) will always lie on one of the two spheres on the top and bottom of the capsule. All you'd have to do is determine the closest points on those spheres like you normally do for spheres and then cast that on the triangle plane and then reverse intersect the capsule. Haven't put a lot of thought in it, but that seems like a good basis. Let me know how it works out.   ;  I'm not sure what you mean by all of that. Really I'm just finding which point along center line of the capsule is closest to the triangle and then treating the difference between the closest point on the triangle and the closest point on that capsule line as an axis to test. The rest of the axes are pretty self explanatory.I think I've done enough testing to say that this works and I'm happy with the result. I should probably worry about speeding things up only if it really becomes a problem. 