# Capsule line intersectionpoint only

This topic is 1241 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites

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.

##### Share on other sites

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.

##### Share on other sites

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!

Edited by KurtO

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013643
×