Capsule line intersectionpoint only

Started by
2 comments, last by Kurt-olsson 8 years, 9 months ago
Hi

I have made a capsule by making two circles and two lines between them (on the edges)

I use lineintersection and closest point to find out if the capsule intersects any lines, this works perfect and i get the intersectionpoint on the lines and where the closest point to the sphere is.

My problem is, i cannot get the circles intersectionpoint with radius. I have tried cutting velocity according to distance etc but its only working 95% correctish.

Is it possible to get the circle intersection from the capsule intersection point?
Advertisement

Maybe someone else will but I'm definitely not quite understanding your question. Could you give more details or post a diagram?

I implemented capsule collisions once.. to the best of my memory, to determine the closest point on a line to a capsule, I checked the distance between the two center center points to the line (point to infinite-line distance calculation) and then the distance between the line and the straight section of the cylinder (infinite-line to infinite-line distance calculation), and then projected the resulting closest point onto the line segment connecting the sphere center points to see if it was inside the cylinder portion. I had some simple logic to determine which of the 3 options was closest.

Hope that's somewhat helpful.. if not, please post more details.

So you're intersecting a line and a capsule? You should represent the capsule with two points and a radius. Then you can do closest point between two lines calculation, and then use the radius to see if there was penetration. Getting a point of collision is pretty trivial since you have the penetration depth + axis of minimum separation via closest points.

I did some test with two points and 3 rays that were traced for collision.

I ended up with just shooting one ray for my solution and i also didnt need to have the exact position of collision,

this is just to prevent the player from going through walls at great speeds.

It ended up working great with just line-line intersection checks and then cut the velocity with the time (vel / distance of intersection) - some small value to be safe.

I forgot to say this is only in 2D.

thanks for the help! smile.png

This topic is closed to new replies.

Advertisement