Collision.CollisionSegment Class
The CollisionSegment class allow you to define a segment to test collision width other segments and collision circles.
Constructor
Collision.CollisionSegment
-
x1
-
y1
-
x2
-
y2
Parameters:
-
x1
Numberthe x coordinate of the first point of the segment
-
y1
Numberthe y coordinate of the first point of the segment
-
x2
Numberthe x coordinate of the second point of the segment
-
y2
Numberthe y coordinate of the second point of the segment
Methods
isCollidingCircle
-
circle
The isCollidingCircle method allow you to test the collision beetween the current object and the circle object
Parameters:
-
circle
CollisionCirclethe CollisionCircle to test the interection with the CollisionSegment.
Returns:
isCollidingSegment
-
segment
The isCollidingSegment method allow you to test if the current segment is colliding another segment.
Parameters:
-
segment
CollisionSegmentthe CollisionSegment to test if is colliding the current collision segment object.
Returns:
Properties
px
Number
the x coordinate of the first point of the CollisionSegment
py
Number
the y coordinate of the first point of the CollisionSegment
vector
Vector2D
vector representing the segment (from x1;y2 to x2;y2)