RectangleCollider

Extends: Collider

Collider with the shape of a rectangle, width x height, whose top-left corner is at (offset.x, offset.y) from the entity's position. World +y is up, so the rectangle spans offset.x to offset.x + width, and offset.y - height to offset.y.

Properties

  • width (float)
  • height (float)

Constructor

new RectangleCollider( colliderName: string, args?: roAssociativeArray, ): RectangleCollider

Create a new RectangleCollider

Parameters

  • colliderName (string) — name of this collider
  • args (roAssociativeArray, optional, default: "{}") — additional properties (e.g {width: 10, height: 20})

Instance Methods

refreshColliderRegion(): void

Returns

  • void

raycastCheck( entityPosition: BGE.Math.Vector, rayOrigin: BGE.Math.Vector, rayDirection: BGE.Math.Vector, maxDistance: float, ): BGE.RaycastHit

Parameters

  • entityPosition (BGE.Math.Vector)
  • rayOrigin (BGE.Math.Vector)
  • rayDirection (BGE.Math.Vector)
  • maxDistance (float)

Returns

debugDraw( renderObj: Renderer, position: BGE.Math.Vector, color?: integer, addName?: boolean, font?: roFont, ): void

Parameters

  • renderObj (Renderer)
  • position (BGE.Math.Vector)
  • color (integer, optional, default: "&hFF0000FF")
  • addName (boolean, optional, default: false)
  • font (roFont, optional, default: "invalid")

Returns

  • void