src/Trigger.js
/**
 * A volume that can send a trigger signal if a trigger object enters it.
 * If the volume has a target the events are sent to it. If not the events are sent to the entity entering.
 * 
 * @param name is string
 * @param rect is a Rectf or null
 * @param parent is a TriggerParticle or null
 * @param target is an object with onTrigger(event, volume, object) method, or null
 * @param [onenter] is a string, signaled when something enters the volume.
 * @param [onexit] is a string, signaled when something exits the volume.
 * @returns {TriggerVolume}
 */
A volume that can send a trigger signal if a trigger object enters it.
If the volume has a target the events are sent to it. If not the events are sent to the entity entering.


A volume that can send a trigger signal if a trigger object enters it . If the volume has a target the events are sent to it . If not the events are sent to the entity entering .
function TriggerVolume(name, rect, parent, target, onenter, onexit) {
    assert(name != null && ( onenter != null || onexit != null));    
    assert(rect instanceof Rectf);
    assert(parent === null || parent instanceof TriggerParticle);
    assert(target !== undefined);
    if(onenter === undefined) onenter = null;
    if(onexit === undefined) onexit = null;
    this.name = name;
    this.rect = rect;
    this.parent = parent;
    this.target = target;
    this.onenter = onenter;
    this.onexit = onexit;
}
function TriggerVolume ( name , rect , parent , target , onenter , onexit ) { assert ( name != null && ( onenter != null || onexit != null ) ) ; assert ( rect instanceof Rectf ) ; assert ( parent === null || parent instanceof TriggerParticle ) ; assert ( target !== undefined ) ; if ( onenter === undefined ) onenter = null ; if ( onexit === undefined ) onexit = null ; this . name = name ; this . rect = rect ; this . parent = parent ; this . target = target ; this . onenter = onenter ; this . onexit = onexit ; }
A volume that can send a trigger signal if a trigger object enters it.
A volume that can send a trigger signal if a trigger object enters it .