View Source Exray.Shapes.Collision (Exray v0.6.0)
Check if two things intersect.
Summary
Functions
Check collision between circle and rectangle
Check collision between two circles
Check the collision between two lines defined by two points each, returns collision point by reference
Check if point is inside circle
Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
Check if point is within a polygon described by array of vertices
Check if point is inside rectangle
Check if point is inside a triangle
Check collision between two rectangles
Get collision rectangle for two rectangles collision
Functions
@spec check_collision_circle_rec( center :: Exray.Structs.Vector2.t(), radius :: float(), rec :: Exray.Structs.Rectangle.t() ) :: colliding :: boolean()
Check collision between circle and rectangle
@spec check_collision_circles( center1 :: Exray.Structs.Vector2.t(), radius1 :: float(), center2 :: Exray.Structs.Vector2.t(), radius2 :: float() ) :: colliding :: boolean()
Check collision between two circles
check_collision_lines(start_pos_1, end_pos_1, start_pos_2, end_pos_2, collision_point)
View Source@spec check_collision_lines( start_pos_1 :: Exray.Structs.Vector2.t(), end_pos_1 :: Exray.Structs.Vector2.t(), start_pos_2 :: Exray.Structs.Vector2.t(), end_pos_2 :: Exray.Structs.Vector2.t(), collision_point :: [Exray.Structs.Vector2.t()] ) :: colliding :: boolean()
Check the collision between two lines defined by two points each, returns collision point by reference
@spec check_collision_point_circle( point :: Exray.Structs.Vector2.t(), center :: Exray.Structs.Vector2.t(), radius :: float() ) :: colliding :: boolean()
Check if point is inside circle
@spec check_collision_point_line( point :: Exray.Structs.Vector2.t(), p1 :: Exray.Structs.Vector2.t(), p2 :: Exray.Structs.Vector2.t(), threshold :: integer() ) :: colliding :: boolean()
Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
@spec check_collision_point_poly( point :: Exray.Structs.Vector2.t(), points :: [Exray.Structs.Vector2.t()] ) :: colliding :: boolean()
Check if point is within a polygon described by array of vertices
@spec check_collision_point_rec( point :: Exray.Structs.Vector2.t(), rec :: Exray.Structs.Rectangle.t() ) :: colliding :: boolean()
Check if point is inside rectangle
@spec check_collision_point_triangle( point :: Exray.Structs.Vector2.t(), p1 :: Exray.Structs.Vector2.t(), p2 :: Exray.Structs.Vector2.t(), p3 :: Exray.Structs.Vector2.t() ) :: colliding :: boolean()
Check if point is inside a triangle
@spec check_collision_recs( rec1 :: Exray.Structs.Rectangle.t(), rec2 :: Exray.Structs.Rectangle.t() ) :: colliding :: boolean()
Check collision between two rectangles
@spec get_collision_rec( rec1 :: Exray.Structs.Rectangle.t(), rec2 :: Exray.Structs.Rectangle.t() ) :: rectangle :: Exray.Structs.Rectangle.t()
Get collision rectangle for two rectangles collision