CopperLicht API Documentation
Class CL3D.AnimatorOnProximity
Scene node animator which invokes a callback function when the scene node gets near another scene node.
Extends
CL3D.Animator.
Class Overview
CL3D.AnimatorOnProximity(scene, radius, idOfSceneNode, functionToCall, triggerOnLeave)
Scene node animator which invokes a callback function when the scene node gets near another scene node.
It works like in this example:
var yourFunction = function(){ alert('now near your scene node!'); } var animator = new CL3D.AnimatorOnProximity(engine.getScene(), 100, 34534, yourFunction, false); yourSceneNode.addAnimator(animator);
- Parameters:
- scene
- {CL3D.Scene} the current scene
- radius
- {Number} the proximity radius to use
- idOfSceneNode
- {Number} The unique id (see CL3D.SceneNode.id of the scene node which will trigger this
- functionToCall
- {function} a function which should be called when the scene node has been clicked. The function will be given two parameters: The node this is attached to and the node colliding.
- triggerOnLeave
- {Boolean} set to false to let this trigger when the radius is entered, to true if when the radius is left
Method Attributes | Method Name and Description |
---|---|
animateNode(n, timeMs)
Animates the scene node it is attached to and returns true if scene node was modified.
|
|
getType()
Returns the type of the animator.
|
- Methods borrowed from class CL3D.Animator:
- createClone, onKeyDown, onKeyUp, onMouseDown, onMouseMove, onMouseUp, onMouseWheel
Method Detail
animateNode(n, timeMs)
Animates the scene node it is attached to and returns true if scene node was modified.
- Parameters:
- {CL3D.SceneNode} n
- The Scene node which needs to be animated this frame.
- {Integer} timeMs
- The time in milliseconds since the start of the scene.
getType()
Returns the type of the animator.
For the AnimatorOnProximity, this will return 'oncollide'.