Function VectorMath.CapsuleLineIntersectionFactors
CapsuleLineIntersectionFactors
(float2 capsuleStart, float2 capsuleDir, float capsuleLength, float2 lineStart, float2 lineDir, float radius)
Calculates the intersection points between a "capsule" (segment expanded by a radius), and a line.
Public
Static
float2 CapsuleLineIntersectionFactors (
float2 | capsuleStart | Center of the capsule's first circle |
float2 | capsuleDir | Main axis of the capsule. Must be normalized. |
float | capsuleLength | Distance betwen the capsule's circle centers. |
float2 | lineStart | A point on the line |
float2 | lineDir | The (normalized) direction of the line. |
float | radius | The radius of the circle. |
Calculates the intersection points between a "capsule" (segment expanded by a radius), and a line.
Return
(t1, t2), the intersection points on the form lineStart + lineDir*t. Where t2 >= t1. If t2 < t1 then there are no intersections.