true to enable the behavior, false to disable it
Return true if the behavior is activated
This method is called each tick after events are done.
This method is called each tick before events are done.
Get the name of the behavior.
The behavior's name.
Get the name identifier of the behavior.
The behavior's name identifier.
Reimplement this method to do extra work when the behavior is activated (after
it has been deactivated, see onDeActivate
).
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).
Reimplement this method to do extra work when the behavior is deactivated.
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
).
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.
Called at each frame after events. Call doStepPostEvents.
Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.
The instanceContainer owning the object
Called at each frame before events. Call doStepPreEvents.
Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.
The instanceContainer owning the object
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.
true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).
Update the behavior properties using the provided data.
Should return false
if the behavior does not need any lifecycle function to
be called.
Default, hidden, "capability" behaviors set it to false
.
This avoids useless calls to empty lifecycle functions, which would waste CPU
time (and have a sizeable impact for example when lots of static instances
are living in the scene).
Array containing the end of contacts reported by onContactEnd. The array is updated each time the method onContactEnd is called by the listener, which can be called at any time. This array is cleared just before stepping the world.
Array containing the beginning of contacts reported by onContactBegin. Each contact should be unique to avoid recording glitches where the object loses and regain contact between two frames. The array is updated each time the method onContactBegin is called by the listener, which is only called when stepping the world i.e. in the first preEvent called by a physics behavior. This array is cleared just before stepping the world.
Array containing the exact current contacts with the objects. It is updated each time the methods onContactBegin and onContactEnd are called by the contact listener.
Generated using TypeDoc
De/Activate the behavior