RigidBody is used to allow objects to interact with Physics in your game including collisions and gravity. RigidBody can also be used with the getContacts method to detect collisions and run appropriate code. The Bullet physics engine is used for these calculations.

Constructor

@:value({ flags : null, params : null, mask : 1, group : 1, restitution : 0.0, friction : 0.5, mass : 1.0, shape : Shape.Box })new(shape:Shape = Shape.Box, mass:Float = 1.0, friction:Float = 0.5, restitution:Float = 0.0, group:Int = 1, mask:Int = 1, ?params:Null<RigidBodyParams>, ?flags:Null<RigidBodyFlags>)

Variables

@:value(null)body:RigidBody = null

@:value(false)destroyed:Bool = false

@:value(1)group:Int = 1

@:value(null)heightData:Bytes = null

@:value(0)id:Int = 0

@:value(1)mask:Int = 1

@:value(null)onContact:Array<RigidBody ‑> Void> = null

@:value(false)ready:Bool = false

@:value(null)transform:Transform = null

@:value(null)onReady:() ‑> Void = null

Methods

Inherited Variables

Defined by Trait

@:value("")name:String = ""

object:Object

Object this trait belongs to.

Inherited Methods

Defined by Trait

notifyOnAdd(f:() ‑> Void):Void

Trait is added to an object.

notifyOnInit(f:() ‑> Void):Void

Object which this trait belongs to is added to scene.

notifyOnLateUpdate(f:() ‑> Void):Void

Add late game logic handler.

notifyOnRemove(f:() ‑> Void):Void

Object which this trait belongs to is removed from scene.

notifyOnRender(f:Graphics ‑> Void):Void

Add render handler.

notifyOnRender2D(f:Graphics ‑> Void):Void

Add 2D render handler.

notifyOnUpdate(f:() ‑> Void):Void

Add game logic handler.

remove():Void

Remove the trait from the object.

removeLateUpdate(f:() ‑> Void):Void

Remove late game logic handler.

removeRender(f:Graphics ‑> Void):Void

Remove render handler.

removeRender2D(f:Graphics ‑> Void):Void

Remove 2D render handler.

removeUpdate(f:() ‑> Void):Void

Remove game logic handler.