class MAGES::DeviceManagerModule

Overview

The device manager module base class. More…

class DeviceManagerModule: public MAGES::HubModule
{
public:
    // enums

    enum CameraMode;
    enum Device;

    // properties

    IDriver ActiveDriver;
    IDriver DriverOverride;
    UnityEvent<DriverChangeEventArgs> OnDriverChanged;
    UnityEvent<DriverEvent> OnDriverEvent;
    CameraMode CurrentMode;
    float CameraHeight;
    GameObject MobileNavigationUI;
    IInteractionActions InteractionActions;
    ILocomotionActions LocomotionActions;
    IGenericInputActions GenericActions;
    IMobile3DActions Mobile3DActions;
    GameObject CameraGameObject;
    GameObject CameraRig;
    GameObject LeftController;
    Transform LeftControllerOffset;
    GameObject RightController;
    Transform RightControllerOffset;
    Camera CameraRef;
    GameObject RigPrefab;

    // methods

    virtual bool TrySendHapticImpulse(
        Device device,
        float intensity = 0.8f,
        float duration = 0.1f
    );

    virtual bool IsDeviceAvailable(Device device);

    virtual bool SendHapticPulse(
        string controllerSide,
        float intensity,
        float duration = 0.1f
    );

    virtual bool IsXRControllerAvailable(string controllerName);
};

// direct descendants

class MAGESDeviceManager;
class MAGESDeviceManagerV2;
class StubDeviceManager;

Inherited Members

public:
    // properties

    int Version;

    // methods

    void Startup();
    void Shutdown();
    virtual void UpdateModule(UpdatePhase updatePhase);

Detailed Documentation

The device manager module base class.

Properties

IDriver ActiveDriver

Gets the currently active driver.

IDriver DriverOverride

Gets or sets the override for the active driver.

  • If not null the device manager will try to use this driver instead of the one with the highest priority.

UnityEvent<DriverChangeEventArgs> OnDriverChanged

Gets or sets the event invoked every time the active driver changes.

UnityEvent<DriverEvent> OnDriverEvent

Gets or sets the Unity event invoked every time a driver event occurs.

CameraMode CurrentMode

Gets or sets the selected camera mode.

Deprecated This is obsolete and will be removed in future versions. Instead listen to DeviceManager.OnDriverEvent instead.

float CameraHeight

Gets or sets the camera height.

Deprecated This is obsolete and will be removed in future versions.

GameObject MobileNavigationUI

Gets or sets the mobile navigation UI.

Deprecated This is obsolete and will be removed in future versions.

IInteractionActions InteractionActions

Gets or sets reference to the implementation of Input actions.

Deprecated This is deprecated and will be removed in future versions. Instead listen to DeviceManager.OnDriverEvent instead.

ILocomotionActions LocomotionActions

Gets or sets reference to the implementation of InputValues actions.

Deprecated This is deprecated and will be removed in future versions. Instead listen to DeviceManager.OnDriverEvent instead.

IGenericInputActions GenericActions

Gets or sets reference to the implementation of InputValues actions.

Deprecated This is deprecated and will be removed in future versions. Instead listen to DeviceManager.OnDriverEvent instead.

IMobile3DActions Mobile3DActions

Gets or sets reference to the implementation of InputValues actions.

Deprecated This is deprecated and will be removed in future versions. Instead listen to DeviceManager.OnDriverEvent instead.

GameObject CameraGameObject

Gets or sets reference to the Camera GameObject.

Deprecated This is deprecated and will be removed in future versions. Please use Hub.Instance.Rig.HeadCamera.gameObject instead.

GameObject CameraRig

Gets or sets reference to the Camera Rig.

Deprecated This is deprecated and will be removed in future versions. Please use Hub.Instance.Rig instead.

GameObject LeftController

Gets or sets reference to the Left Controller.

Deprecated This is deprecated and will be removed in future versions. Please use Hub.Instance.Rig.LeftControllerPoint instead.

Transform LeftControllerOffset

Gets or sets the Left Controller Offset. When using differen XR Loaders, each one has a different idle pose for the controllers. This offset is automatically adjusted so that all Loaders have the same idle pose.

Deprecated This is deprecated. Use Hub.Instance.Rig.LeftControllerPoint instead.

GameObject RightController

Gets or sets reference to the Right Controller.

Deprecated This is deprecated and will be removed in future versions. Please use Hub.Instance.Rig.RightControllerPoint instead.

Transform RightControllerOffset

Gets or sets the Right Controller Offset. When using differen XR Loaders, each one has a different idle pose for the controllers. This offset is automatically adjusted so that all Loaders have the same idle pose.

Deprecated This is deprecated. Use Hub.Instance.Rig.RightControllerPoint instead.

Camera CameraRef

Gets or sets reference to the main camera.

Deprecated This is deprecated and will be removed in future versions. Please use Hub.Instance.Rig.HeadCamera instead.

GameObject RigPrefab

Gets the prefab used for the rig.

Deprecated This is deprecated and will be removed in future versions. Please use Hub.Instance.BaseBundle.Rig instead.

Methods

virtual bool TrySendHapticImpulse(
    Device device,
    float intensity = 0.8f,
    float duration = 0.1f
)

Tries to send a haptic impulse to the left controller.

If the left controller is not available, or the driver does not support haptic impulses, this method does nothing.

Parameters:

device

The device to send the haptic impulse to.

intensity

The intensity of the pulse.

duration

The duration of the pulse.

Returns:

true if the haptic impulse command was successful.

virtual bool IsDeviceAvailable(Device device)

Gets if the device is available and tracking for it is supported.

Parameters:

device

The device.

Returns:

true if the device is available.

virtual bool SendHapticPulse(
    string controllerSide,
    float intensity,
    float duration = 0.1f
)

Sends Haptic Pulse to respective controller.

Deprecated This method is deprecated and will be removed in future versions. Please use TrySendHapticImpulseLeftController or TrySendHapticImpulseRightController instead.

Parameters:

controllerSide

Which controller side to send pulse to, LeftHand or RightHand.

intensity

The intensity of the pulse.

duration

The duration of the pulse.

Returns:

true if haptics are supported and the operation was successful.

virtual bool IsXRControllerAvailable(string controllerName)

Checks if the XRController is available.

Deprecated This method is obsolete and will be removed in future versions. Use IsDeviceAvailable instead.

Parameters:

controllerName

The name of the controller you want to check.

Returns:

true if the XRController is available.