Unigine::Plugins::AppOculus Class
Header: | #include <plugins/UnigineAppOculus.h> |
This set of functions is available when the AppOculus plugin is loaded.
AppOculus plugin cannot be used in a Qt-based application
If the plugin is loaded together with the engine, the HAS_APP_OCULUS definition is set. This definition can be used, for example, to avoid errors if the plugin is not loaded: the code in which the plugin functions are executed can be wrapped around as follows:
#ifdef HAS_APP_OCULUS
// engine.oculus functions
#endif
For more detailed information on application development with the Oculus Rift support, check also the following:
- openvr File Reference
- The Oculus Best Practices document and the Oculus Developer Guide document that can be downloaded from the official website.
See also#
A UnigineScript API sample <UnigineSDK>/data/samples/plugins/app_oculus_00
AppOculus Class
Enums
AXIS#
TOUCH#
BUTTON#
DEVICE#
Name | Description |
---|---|
DEVICE_HMD = 0 | Oculus head-mounted display. |
DEVICE_CONTROLLER_LEFT = 1 | Left controller. |
DEVICE_CONTROLLER_RIGHT = 2 | Right controller. |
VIEWPORT#
Name | Description |
---|---|
VIEWPORT_BLACK_SCREEN = 0 | No image (black screen). |
VIEWPORT_MONO = 1 | Mono image. |
VIEWPORT_STEREO = 2 | Stereo image (left and right eye). |
VIEWPORT_STEREO_FINAL = 3 | Stereoscopic spherical image. |
Members
Math::vec2 getControllerAxis ( AppOculus::DEVICE device, AppOculus::AXIS axis ) #
Returns the coordinates of the specified controller axis along the X and Y axes.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
- AppOculus::AXIS axis - One of the AXIS variables.
Return value
X and Y in the range of [-1;1] ([0;1] for a trigger).bool getControllerButtonPressed ( AppOculus::BUTTON button ) #
Returns the value indicating if the specified button is pressed.Arguments
- AppOculus::BUTTON button - A button, one of the BUTTON variables.
Return value
true if the button is pressed; otherwise - false.bool getControllerButtonTouched ( AppOculus::TOUCH button ) #
Returns the value indicating if the specified button is touched.Arguments
- AppOculus::TOUCH button - A button, one of the TOUCH variables.
Return value
true if the button is touched; otherwise - false.void setControllerVibration ( AppOculus::DEVICE device, unsigned short duration, float amplitude ) #
Sets the vibration of the given duration and amplitude.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
- unsigned short duration - Duration of the vibration.
- float amplitude - Amplitude of the vibration.
Math::vec3 getDeviceAngularVelocity ( AppOculus::DEVICE device ) #
Returns a device angular velocity, in radians per second.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
Angular velocity.bool isDeviceConnected ( AppOculus::DEVICE device ) #
Returns a value indicating if the device connected to the slot.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
true - connected; false - not connected.Math::mat4 getDevicePose ( AppOculus::DEVICE device ) #
Returns a single pose for a tracked device.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
Identity matrix.Math::vec3 getDeviceVelocity ( AppOculus::DEVICE device ) #
Returns a device velocity in tracker space, in meters per second.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
Velocity.void setEnabled ( bool enabled ) #
Toggles the VR mode.Arguments
- bool enabled - true to enable the VR mode; false to disable it.
bool isEnabled ( ) const#
Returns the value indicating if the VR mode is enabled or not.Return value
true if the VR mode is enabled; false if it is disabled.void setHeadPositionLock ( bool lock ) #
Locks the head position.Arguments
- bool lock - true to lock the head position.
bool isHeadPositionLocked ( ) const#
Returns the value indicating if the head position is locked.Return value
true if the head position is locked; otherwise - false.void setHeadRotationLock ( bool lock ) #
Locks the head rotation.Arguments
- bool lock - true to lock the head rotation.
bool isHeadRotationLocked ( ) const#
Returns the value indicating if the head rotation is locked.Return value
true if the head rotation is locked; otherwise - false.bool isPoseValid ( AppOculus::DEVICE device ) #
Returns a value indicating if the device pose is valid.Arguments
- AppOculus::DEVICE device - Device ID, one of the DEVICE variables.
Return value
true - valid; false - invalid.void setPositionScale ( float scale ) #
Sets a new scale for the world. When increasing the scale, the objects get smaller when they are farther away.Arguments
- float scale - World scale.
float getPositionScale ( ) const#
Returns the current world scale. When increasing the scale, the objects get smaller when they are farther away.Return value
World scale.AppOculus::VIEWPORT getViewportMode ( ) const#
Returns a value indicating the current viewport mode, that determines the type of image to be displayed in the viewport.Return value
Current viewport mode. One of the VIEWPORT variables.void setViewportMode ( AppOculus::VIEWPORT mode ) #
Sets the viewport mode, that world scales the type of image to be displayed in the viewport.Arguments
- AppOculus::VIEWPORT mode - Viewport mode. One of the VIEWPORT variables.
const char * getVersion ( ) const#
Returns the libOVRT version of the HMD.Return value
The libOVR version (a UTF-8 encoded null-terminated version string).int getHmdType ( ) const#
Returns the OpenVR type of the HMD.Return value
HMD type.const char * getHmdProductName ( ) const#
Returns the name of the HMD (UTF-8 encoded product identification string).Return value
Device name.const char * getHmdManufacturer ( ) const#
Returns the name of the HMD manufacturer (UTF-8 encoded identification string).Return value
Manufacturer name.int getHmdVendorID ( ) const#
Returns the HID (USB) vendor identifier of the HMD.Return value
Vendor ID.int getHmdProductID ( ) const#
Returns the HID (USB) product identifier of the HMD.Return value
HID product identifier.int getHmdFirmwareMajor ( ) const#
Returns the major version of the HMD firmware.Return value
Major version of the device firmware.int getHmdFirmwareMinor ( ) const#
Returns the minor version of the HMD firmware.Return value
Minor version of the device firmware.float getHmdTrackerHFov ( ) const#
Returns the horizontal FOV (if present) of the tracking sensor frustum in degrees.Return value
Horizontal FOV of the tracking sensor frustum in degrees.float getHmdTrackerVFov ( ) const#
Returns the vertical FOV (if present) of the tracking sensor frustum in degrees.Return value
Vertical FOV of the tracking sensor frustum in degrees.float getHmdTrackerZNear ( ) const#
Returns the distance from the tracking sensor to the near Z clipping plane of viewing frustum.. The returned value was already multiplied by the current world scale.Return value
Distance from the tracking sensor to the tracking frustum near Z in meters.float getHmdTrackerZFar ( ) const#
Returns the distance from the tracking sensor to the far Z clipping plane of viewing frustum.. The returned value was already multiplied by the current world scale.Return value
Distance from the tracking sensor to the tracking frustum far Z in meters.int getDefaultHmdCaps ( ) const#
Returns HMD capability bits that are default for the current device.Return value
Default HMD capability bits.int getDefaultTrackingCaps ( ) const#
Returns tracking capability bits that are default for the current system.Return value
Default tracking capability bits.int getAvailableHmdCaps ( ) const#
Returns HMD capability bits that the device currently supports.Return value
HMD capability bits.int getAvailableTrackingCaps ( ) const#
Returns tracking capability bits that the system currently supports.Return value
Tracking capability bits.Math::vec4 getHmdDefaultFov ( int num ) const#
Returns the default optical field of view for the specified eye.Arguments
- int num - Eye: 0 for the left eye, 1 for the right eye.
Return value
Default field of view.Math::vec4 getHmdMaxFov ( int num ) const#
Returns the maximum optical field of view that can be practically rendered for the specified eye.Arguments
- int num - Eye: 0 for the left eye, 1 for the right eye.
Return value
Maximum field of view.int getHmdWidth ( ) const#
Returns the horizontal resolution of the full HMD screen (both eyes) in pixels.Return value
Horizontal resolution in pixels.int getHmdHeight ( ) const#
Returns the vertical resolution of the full HMD screen (both eyes) in pixels.Return value
Vertical resolution in pixels.const char * getHmdSerialNumber ( ) const#
Returns the serial number of the HMD.Return value
HMD Serial number.void resetTracking ( ) #
Re-centers the sensor position and orientation: the (x,y,z) positional components and the yaw component of orientation. The roll and pitch components are always determined by gravity and cannot be redefined. See also ovr_RecenterTrackingOrigin method in the OVR_CAPI.h file reference.Math::vec4 getEyeFov ( int num ) const#
Returns the current field of view of the given eye.Arguments
- int num - Eye: 0 for the left eye, 1 for the right eye.
Return value
Eye field of view.Math::vec3 getEyePosition ( int num ) const#
Returns the current position of the given eye. The returned value was already multiplied by the current world scale.Arguments
- int num - Eye: 0 for the left eye, 1 for the right eye.
Return value
The eye position.Math::quat getEyeRotation ( int num ) const#
Returns the current orientation of the given eye.Arguments
- int num - Eye: 0 for the left eye, 1 for the right eye.
Return value
The eye orientation.Math::vec3 getHeadPosition ( ) const#
Returns the current position of the head. The returned value was already multiplied by the current world scale.Return value
Position of the head.Math::quat getHeadRotation ( ) const#
Returns the current orientation of the head.Return value
Orientation of the head.Math::vec3 getHeadLinearVelocity ( ) const#
Returns the current linear velocity of the head.Return value
Linear velocity of the head in meters per second.Math::vec3 getHeadAngularVelocity ( ) const#
Returns the current angular velocity of the head.Return value
Angular velocity of the head in radians per second.Math::vec3 getHeadLinearAcceleration ( ) const#
Returns the current linear acceleration of the head.Return value
Linear acceleration of the head in meters per second squared.Math::vec3 getHeadAngularAcceleration ( ) const#
Returns the current angular acceleration of the head.Return value
Angular acceleration of the head in radians per second squared.Math::vec3 getHandPosition ( int num ) const#
Returns the current position of the given hand. The returned value was already multiplied by the current world scale.Arguments
- int num - Hand: 0 for the left hand, 1 for the right hand.
Math::quat getHandRotation ( int num ) const#
Returns the current orientation of the given hand.Arguments
- int num - Hand: 0 for the left hand, 1 for the right hand.
Math::vec3 getTrackerPosition ( ) const#
Returns the current position of the sensor relative to the tracking origin. The returned value was already multiplied by the current world scale.Return value
Position of the sensor relative to the tracking origin.Math::quat getTrackerRotation ( ) const#
Returns the current orientation (sensor roll and pitch) of the sensor relative to the tracking origin.Return value
Orientation (roll and pitch) of the sensor relative to the tracking origin.Math::vec3 getLeveledTrackerPosition ( ) const#
Returns the current position of the leveled sensor (aligned with gravity) relative to the tracking origin. The returned value was already multiplied by the current world scale.Return value
Position of the leveled sensor relative to the tracking origin.Math::quat getLeveledTrackerRotation ( ) const#
Returns the current orientation (only sensor yaw, not roll and pitch) of the leveled sensor (aligned with gravity) relative to the tracking origin.Return value
Orientation (yaw) of the sensor relative to the tracking origin.unsigned int getTrackingStatus ( ) const#
Returns the current status of the sensor tracking.Return value
Status of the sensor tracking.bool isVisible ( ) const#
Returns a value indicating if the process has VR focus and thus is visible in HMD.Return value
true if the information about the HMD session status is visible; otherwise, false.Last update:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)