Main Content

vrspacemouse

Create space mouse object

Syntax

mouse = vrspacemouse(id)

Description

mouse = vrspacemouse(id) creates a space mouse object capable of interfacing with a space mouse input device. The id parameter is a string that specifies the space mouse connection: COM1, COM2, COM3, COM4, USB1, USB2, USB3, or USB4.

The vrspacemouse object has several properties that influence the behavior of the space mouse input device. The properties can be read or modified using dot notation (e.g., mouse.DominantMode = true;).

Properties

Valid properties are (property names are case-sensitive):

PropertyDescription
PositionSensitivityMouse sensitivity for translations. Higher values correspond to higher sensitivity.
RotationSensitivityMouse sensitivity for rotations. Higher values correspond to higher sensitivity.
DisableRotationFixes the rotations at initial values, allowing you to change positions only.
DisableTranslationFixes the positions at the initial values, allowing you to change rotations only.
DominantModeIf this property is true, the mouse accepts only the prevailing movement and rotation and ignores the others. This mode is very useful for beginners using a space mouse.
UpperPositionLimitPosition coordinates for the upper limit of the mouse.
LimitPositionEnables mouse position limits. If false, the object ignores the UpperPositionLimit and LowerPositionLimit properties.
LowerPositionLimitPosition coordinates for the lower limit of the mouse.
NormalizeOutputAngleDetermines whether the integrated rotation angles should wrap on a full circle (360°). This is not used when you read the Output Type as Speed.
InitialPositionInitial condition for integrated translations. This is not used when you set the Output Type to Speed.
InitialRotationInitial condition for integrated rotations. This is not used when you set the Output Type to Speed.

Methods

MethodDescription
buttonb = button(mouse, n) reads the status of space mouse button number n. Button status is returned as logical 0 if not pressed and logical 1 if pressed. n can be a vector to return multiple buttons.
closeclose(mouse) closes and invalidates the space mouse object. The object cannot be used once it is closed.
positionp = position(mouse, n) reads the position of space mouse axis number n. n can be a vector to return positions of multiple axes. Translations and rotations are integrated. Outputs are the position and orientation in the form of roll/pitch/yaw angles.
speeds = speed(mouse, n) reads the speed of space mouse axis number n. n can be a vector to return the speeds of multiple axes. No transformations are done. Outputs are the translation and rotation speeds.
viewpointp = viewpoint(mouse) reads the space mouse coordinates in virtual world viewpoint format. Translations and rotations are integrated. Outputs are the position and orientation in the form of an axis and an angle. You can use these values as viewpoint coordinates in virtual world.

Version History

Introduced in R2007b