Back to Events

nodeenter

The nodeenter event is handling the event when the following four situations happen:

  • mouse interface: Will be fired when the mouse enters the bounding box of the node.
  • touch interface: Will be fired when touching inside the bounding box of the node.
  • VR mode with controller: Will be fired when the direction ray of the controller intersect with the bounding box of the node.
  • VR mode without controller: Will be fired when the ray of view direction intersect with the bounding box of the node.

Note that we use the fast hit testing to detect the intersection, which means only the object with the property interactive set to be true will be considered. To change this property, you can either modify it inside the scene or use our API set:

// true for enable and false for disable
api.scene.set({id:nodeId, plug:'Properties', property:'interactive'}, true);

The handle function of nodeenter event takes one argument, a string of the target node id.

nodeleave

The nodeleave event are exactly the same with nodeenter except it handles the situation when leaving the node bounding box.

See Mouse, Touch and VR interactions as an example. Inside the demo, we first enable the interactive property of all the boxes and cylinders. Then use the nodeenter event to set the target node's material color to red and use the nodeleave event to change the object's color back.