Skip to main content

EdgeCollider

Edge is a single line collider to create collisions with a single line.

Hierarchy

Index

Constructors

constructor

Properties

begin

begin: Vector

publiccomposite

composite: CompositeCollider = null

Composite collider if any this collider is attached to

WARNING do not tamper with this property

end

end: Vector

publicevents

events: EventEmitter<any> = ...

publicreadonlyid

id: Id<collider> = ...

offset

offset: Vector

Pixel offset of the collision collider relative to the collider, by default (0, 0) meaning the collider is positioned on top of the collider.

publicowner

owner: Entity<any>

Accessors

publicaxes

  • Get the axis associated with the edge


    Returns Vector[]

publicbounds

  • Get the axis aligned bounding box for the edge collider in world space


    Returns BoundingBox

publiccenter

  • Get the center of the collision area in world coordinates


    Returns Vector

publiclocalBounds

  • Get the axis aligned bounding box for the edge collider in local space


    Returns BoundingBox

publicworldPos

  • Position of the collision collider in world coordinates


    Returns Vector

Methods

publicasLine

  • Returns this edge represented as a line in world coordinates


    Returns LineSegment

publicasLocalLine

  • Return this edge as a line in local line coordinates (relative to the position)


    Returns LineSegment

publicclone

  • Returns a clone of this Edge, not associated with any collider


    Returns EdgeCollider

publiccollide

publiccontains

  • contains(): boolean
  • Tests if a point is contained in this collision area


    Returns boolean

publicdebug

publicgetClosestLineBetween

  • Returns the closes line between this and another collider, from this -> collider


    Parameters

    Returns LineSegment

publicgetFurthestPoint

  • Find the point on the collider furthest in the direction specified


    Parameters

    Returns Vector

publicgetInertia

  • getInertia(mass: number): number

publicgetLength

  • getLength(): number
  • Returns the length of the line segment in pixels


    Returns number

publicgetSlope

  • Returns the slope of the line in the form of a vector


    Returns Vector

publicproject

  • Project the edge along a specified axis


    Parameters

    Returns Projection

publicrayCast

  • Return the point on the border of the collision collider that intersects with a ray (if any).


    Parameters

    • ray: Ray
    • max: number = Infinity

    Returns RayCastHit

publictouching

  • Returns a boolean indicating whether this body collided with or was in stationary contact with the body of the other [[Collider]]


    Parameters

    Returns boolean

publicupdate

  • Updates collider world space geometry


    Parameters

    Returns void