Collision: Difference between revisions

From Crumbled World Wiki
(Created page with "{{:CollisionExampleCode}} ==Static functions== {| class="wikitable" !|return !|function !|description |- |bool, Vec2 |lineSegmentLineSegmentIntersection(Line2D line1, Line2D line2) |Return true if the two segmented line intersect each other. if return true second output is the intersection position. |- |float |linePointLength2(L...")
 
(No difference)

Latest revision as of 13:36, 5 July 2025

CollisionExampleCode

Static functions

return function description
bool, Vec2 lineSegmentLineSegmentIntersection(Line2D line1, Line2D line2) Return true if the two segmented line intersect each other. if return true second output is the intersection position.
float linePointLength2(Lin3D line, Vec3 point) returs the shortest distance from point to the line
bool, Vec3, Vec3 intersect_RayTriangle(Ray aRay, Vec3 t1, Vec3 t2, Vec3 t3) Return true if the Ray intersect the triangle. second return is the collisionPosition and the third return is the collisionPosNormal.
float lineSegmentPointLength2(Line2D line, Vec2 point) Return The minimum distance between the segmented line and the point.
float lineSegmentPointLength2(Line3D line, Vec3 point) Return The minimum distance between the segmented line and the point.
float, Vec2, Vec2 lineSegmentLineSegmentLength2(Line2D line1, Line2D line2) Return The minimum distance between the two segmented lines. second out parameter is collision position on line1, third return is collision position on line2
float, Vec3, Vec3 lineSegmentLineSegmentLength2(Line3D line1, Line3D line2) Return The minimum distance between the two segmented lines. second out parameter is collision position on line1, third return is collision position on line2
bool, Vec2, Vec2 lineSegmentCircleIntersection(Line2D line, Sphere aCircle) Return true if the line intersect the circle. When return true the two collision point on the circle is returned.
bool, Vec3 lineSegmentSphereIntersection(Line3D line, Sphere aCircle) Return true if the line intersect the sphere, second return value is the first intersection position if the function return true. outCollisionPos is the collision point on the sphere
bool lineSegmentTriangleIntersection(Line3D line, Vec3 v1, Vec3 v2, Vec3 v3) Return true if the line intersect the triangle.
bool lineSegmentPlaneIntersection(Vec3 outCollisionPos, Line3D line, Vec3 planeNormal, Vec3 pointInPlane) Return true if the line intersect the plane.
bool, Vec3 line3DSegmentBoxIntersection(Line3D line, Box box) Return true if the line intersect the box. if returned true the second return variable is the intersection position on the box