Collision.CollisionCircle Class
The CollisionCircle class allow you to create a CollisionCircle to test intersections with other collision objects like circles, segments or boxes.
Constructor
Collision.CollisionCircle
-
x
-
y
-
radius
Parameters:
-
x
Numberthe x coordinate of the CollisionCircle
-
y
Numberthe y coordinate of the CollisionCircle
-
radius
Numberthe radius of the CollisionCircle
Item Index
Methods
isCollidingBox
-
box
The isCollidingBox method allow you to test if the current CollisionCircle is colliding the CollidingBox in parameter.
Parameters:
-
box
CollisionBoxthe CollidingBox to test collision with.
Returns:
isCollidingCircle
-
circle
The method is CollidingCircle allow you to test if two circles are Colliding. Let's see an example :
var circle = new CollisionCircle(x, y, radius);
var circle2 = new CollisionCircle(x2, y2, radius2);
var result = circle.isCollidingCircle(circle2);
If result is true, so the circle object is colliding the circle2 object. If result if false, so the circle object is not colliding the circle2 object.
Parameters:
-
circle
CollisionCirclethe CollisionCircle to test collision with.
Returns:
isCollidingSegment
-
ax
-
ay
-
bx
-
by
The isCollidingSegment method allow you to test if the CollisionCircle is Colliding a segment
Parameters:
-
ax
Numberthe x coordinate of the first point of the segment to test intersection with.
-
ay
Numberthe y coordinate of the first point of the segment to test intersection with.
-
bx
Numberthe x coordinate of the second point of the segment to test intersection with.
-
by
Numberthe y coordinate of the second point of the segment to test intersection with.
Returns:
true
if the current CollisionCircle is colliding the segment.
Otherwise return false
.
isPointInside
-
px
-
py
The isPointInside method allow you to test if a point is inside the current circle
Parameters:
-
px
Numberthe x coordinate of the point
-
py
Numberthe y coordinate of the point
Returns:
Properties
radius
Number
type
String
type of Collision object