Class: Ray
Defined in: physics/raycast.ts:82
Ray class that represents a ray in 2D space.
Constructors
Constructor
new Ray(
start,end):Ray
Defined in: physics/raycast.ts:92
Creates a new Ray object.
Parameters
start
The starting point of the ray
end
The ending point of the ray
Returns
Ray
Properties
end
end:
Vector2
Defined in: physics/raycast.ts:84
start
start:
Vector2
Defined in: physics/raycast.ts:83
vertices
vertices:
Vector2[] =[]
Defined in: physics/raycast.ts:85
Accessors
difference
Get Signature
get difference():
Vector2
Defined in: physics/raycast.ts:282
Returns
isHorizontal
Get Signature
get isHorizontal():
boolean
Defined in: physics/raycast.ts:297
Returns
boolean
isVertical
Get Signature
get isVertical():
boolean
Defined in: physics/raycast.ts:301
Returns
boolean
offsetY
Get Signature
get offsetY():
number
Defined in: physics/raycast.ts:290
Returns
number
slope
Get Signature
get slope():
number
Defined in: physics/raycast.ts:286
Returns
number
Methods
calculateNormal()
calculateNormal(
referencePoint):Vector2
Defined in: physics/raycast.ts:264
Calculates the normal vector of the ray at the specified reference point.
Parameters
referencePoint
The reference point to calculate the normal vector from
Returns
The normal vector of the ray at the specified reference point
pointInBounds()
pointInBounds(
point):boolean
Defined in: physics/raycast.ts:246
Checks if a point is within the bounds of the ray.
Parameters
point
The point to check
Returns
boolean
True if the point is within the bounds of the ray, false otherwise
xValueAt()
xValueAt(
y):number
Defined in: physics/raycast.ts:234
Returns the x value on the ray at the specified y.
Parameters
y
number
The y value to check
Returns
number
The x value on the ray at the specified y
yValueAt()
yValueAt(
x):number
Defined in: physics/raycast.ts:222
Returns the y value on the ray at the specified x.
Parameters
x
number
The x value to check
Returns
number
The y value on the ray at the specified x
bodyCollisions()
staticbodyCollisions(rayA,body):RaycastCollision[]
Defined in: physics/raycast.ts:186
Parameters
rayA
Ray
body
Body
Returns
bodyEdges()
staticbodyEdges(body):Ray[]
Defined in: physics/raycast.ts:149
Parameters
body
Body
Returns
Ray[]
collisionPoint()
staticcollisionPoint(rayA,rayB):null|Vector2
Defined in: physics/raycast.ts:131
Parameters
rayA
Ray
rayB
Ray
Returns
null | Vector2
intersect()
staticintersect(rayA,rayB):null|Vector2
Defined in: physics/raycast.ts:97
Parameters
rayA
Ray
rayB
Ray
Returns
null | Vector2