The mouseTrack function lets you register a MAXScript function to track the mouse. While the tracking is going on, this function is called whenever a mouse action occurs, such as a button click or a drag, etc.
The function has the form:
Optionally specifies a scene object to track on. If you don't supply an object, the mouse tracks on the current active grid. Note that the object surface tracker uses the SDK function IntersectRay() which is not reliably implemented on all object types. Editable meshes always work OK, so you can convertToMesh() if needed.
Displays the prompt message in the MAX status line
Relevant when not tracking
on an object surface (no on:
Is where you specify the function to be called as the mouse is dragged over the active grid or object surface. You can specify it is a single function or a function and an argument value in a two element array. The latter form is useful if you have a common callback function for many tasks and want to send in a parameter to control its operation for a particular use. The function you give must be of the following form:
fn callback_fn msg ir obj faceNum shift ctrl alt = ...
in other words, a scripted function of 7 arguments. While the tracking is going on, it is called whenever a mouse action occurs, such as a button click or a drag, etc.
The 'msg' argument is a message code that indicates what kind of action occurred, and can be one of:
#freeMove - means the mouse is moved without a button being pressed
#mousePoint - means the left mouse button has just been pressed
#mouseMove - means the mouse is being dragged with the left button down
#mouseAbort - means the right mouse button was clicked, normally meaning cancel
The grid or surface intersection normal Ray at the current mouse position. The ray has a .pos property giving the point in space of the normal and a .dir property giving the normal's direction vector.
object being dragged over or undefined if no on:
The number of the face the mouse is over if the object being tracked is an editable mesh, undefined otherwise.
'shift', 'ctrl' and 'alt'
or false depending on the down or up state of the
The function should return the special value #continue to continue tracking or any other value to halt tracking. That value then becomes the result of the original mouseTrack() call.
Rollout User-Interface Controls