Friday, January 14, 2005

Pointer Enter & Poiner Leave

More event passways. The last entry discribed how a pointerDown event makes it to a componant that the mouse is over. This path is the same for pointerUp and pointerMove, but pointerEnter & pointerLeave have their own thing going on.

Those events are generated in TRay >> resetSelected, which is called for the activeCamera's pointer in TUserCamera preRender. Remeber that any TRay in a scene will select an object that it is pointing at in the render loop. resetSelected examins the ray's current selectedObject and it's lastSelection object to generated appropriate calls to pointerEnter, pointerLeave & oh yeah, pointerOver (which is called continuously on the selected object for as long as the TRay points at it).

Notes:
1) The TRay only generates the pointerX events if it's doSelect is true, so the camera's downRay does not trigger events.
2) The TRay is handed to the componant with the event, so you could have an object that responds differently to being selected by different pointers.
3) I wondered why these events were render based & not based on mouse event until Orion reminded me that objects in the scene can move themselves in front of the pointer. The render bases select can succesfully select those moving obejcts.