Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows objects to be moved in a realistic way thanks to a physics engine (Box2D).

Hierarchy

Index

Methods

  • activate(enable: boolean): void
  • De/Activate the behavior

    Parameters

    • enable: boolean

      true to enable the behavior, false to disable it

    Returns void

  • activated(): boolean
  • addGearJointBetweenObjects(object: any, ratio: any): void
  • Parameters

    • object: any
    • ratio: any

    Returns void

  • addRevoluteJoint(xPosition: any, yPosition: any): void
  • Parameters

    • xPosition: any
    • yPosition: any

    Returns void

  • addRevoluteJointBetweenObjects(object: any, scene: any, xPosRelativeToMassCenter: any, yPosRelativeToMassCenter: any): void
  • Parameters

    • object: any
    • scene: any
    • xPosRelativeToMassCenter: any
    • yPosRelativeToMassCenter: any

    Returns void

  • applyForce(xCoordinate: any, yCoordinate: any): void
  • Parameters

    • xCoordinate: any
    • yCoordinate: any

    Returns void

  • applyForceTowardPosition(xPosition: any, yPosition: any, length: any): void
  • Parameters

    • xPosition: any
    • yPosition: any
    • length: any

    Returns void

  • applyForceUsingPolarCoordinates(angle: any, length: any): void
  • Parameters

    • angle: any
    • length: any

    Returns void

  • applyImpulse(xCoordinate: any, yCoordinate: any): void
  • Parameters

    • xCoordinate: any
    • yCoordinate: any

    Returns void

  • applyImpulseTowardPosition(xPosition: any, yPosition: any, length: any): void
  • Parameters

    • xPosition: any
    • yPosition: any
    • length: any

    Returns void

  • applyImpulseUsingPolarCoordinates(angle: any, length: any): void
  • Parameters

    • angle: any
    • length: any

    Returns void

  • applyTorque(torque: any): void
  • Parameters

    • torque: any

    Returns void

  • b2Vec2(x: any, y: any): any
  • Return a Box2D.b2Vec2 with the specified coordinates. Should be used instead of doing 'new Box2D.b2Vec2(x, y)'.

    Parameters

    • x: any
    • y: any

    Returns any

  • collisionWith(otherObjectsTable: any): boolean
  • Parameters

    • otherObjectsTable: any

    Returns boolean

  • createBody(): void
  • Returns void

  • doStepPostEvents(runtimeScene: any): void
  • doStepPreEvents(runtimeScene: any): void
  • dontSetAsBullet(): void
  • Returns void

  • getAngularDamping(): any
  • Returns any

  • getAngularVelocity(): any
  • Returns any

  • getBox2DBody(): any
  • Returns any

  • getLinearDamping(): any
  • Returns any

  • getLinearVelocity(): number
  • Returns number

  • getLinearVelocityX(): number
  • Returns number

  • getLinearVelocityY(): number
  • Returns number

  • getName(): string
  • getNameId(): number
  • Get the name identifier of the behavior.

    Returns number

    The behavior's name identifier.

  • isDynamic(): boolean
  • Returns boolean

  • isStatic(): boolean
  • Returns boolean

  • onActivate(): void
  • Reimplement this method to do extra work when the behavior is activated (after it has been deactivated, see onDeActivate).

    Returns void

  • onCreated(): void
  • Reimplement this to do extra work when the behavior is created (i.e: an object using it was created), after the object is fully initialized (so you can use this.owner without risk).

    Returns void

  • onDeActivate(): void
  • onDestroy(): void
  • This method is called when the owner of the behavior is being removed from the scene and is about to be destroyed/reused later or when the behavior is removed from an object (can happen in case of hot-reloading only. Otherwise, behaviors are just de-activated, not removed. See onDeActivate).

    Returns void

  • onObjectHotReloaded(): void
  • This method is called when the owner of the behavior was hot reloaded, so its position, angle, size can have been changed outside of events.

    Returns void

  • setAngularDamping(angularDamping: any): void
  • Parameters

    • angularDamping: any

    Returns void

  • setAngularVelocity(angularVelocity: any): void
  • Parameters

    • angularVelocity: any

    Returns void

  • setAsBullet(): void
  • Returns void

  • setDynamic(): void
  • Returns void

  • setFixedRotation(): void
  • Returns void

  • setFreeRotation(): void
  • Returns void

  • setGravity(xGravity: any, yGravity: any): void
  • Parameters

    • xGravity: any
    • yGravity: any

    Returns void

  • setLinearDamping(linearDamping: any): void
  • Parameters

    • linearDamping: any

    Returns void

  • setLinearVelocity(xVelocity: any, yVelocity: any): void
  • Parameters

    • xVelocity: any
    • yVelocity: any

    Returns void

  • setLinearVelocityX(xVelocity: any): void
  • Parameters

    • xVelocity: any

    Returns void

  • setLinearVelocityY(yVelocity: any): void
  • Parameters

    • yVelocity: any

    Returns void

  • setStatic(): void
  • Returns void

  • Called at each frame after events. Call doStepPostEvents.
    Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

    Parameters

    Returns void

  • Called at each frame before events. Call doStepPreEvents.
    Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

    Parameters

    Returns void

  • updateFromBehaviorData(oldBehaviorData: any, newBehaviorData: any): boolean
  • Called when the behavior must be updated using the specified behaviorData. This is the case during hot-reload, and is only called if the behavior was modified.

    Parameters

    • oldBehaviorData: any
    • newBehaviorData: any

    Returns boolean

    true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).

Constructors

Properties

currentContacts: any = []
name: string
type: string

Generated using TypeDoc