class MAGES::Drivers::Mobile::MobileDriver

Overview

A driver for mobile devices. More…

class MobileDriver: public MAGES::IDriver
{
public:
    // properties

    string Name;
    int DefaultSortOrder;
    bool IsAvailable;
    DriverType DriverType;
    UnityEvent<DriverEvent> OnDriverEvent;
    GameObject ScreenSticksUIPrefab;
    float CameraRotationSpeed;
    float HeadHeight;
    Pose LeftHandOffset;
    Pose RightHandOffset;

    // methods

    void Possess(Rig rig);
    void UnPossess();
    void Update(UpdatePhase updatePhase);
    void Initialize();
    void Deinitialize();

    bool TrySendHapticImpulse(
        DeviceManagerModule.Device device,
        float intensity,
        float duration
    );

    bool IsDeviceAvailable(DeviceManagerModule.Device device);
};

Inherited Members

public:
    // properties

    bool IsAvailable;
    UnityEvent<DriverEvent> OnDriverEvent;
    DriverType DriverType;
    string Name;
    int DefaultSortOrder;

    // methods

    void Initialize();
    void Possess(ComponentLibrary.Framework.Rig rig);
    void Update(UpdatePhase updatePhase);
    void UnPossess();
    void Deinitialize();

    bool TrySendHapticImpulse(
        DeviceManagerModule.Device device,
        float intensity,
        float duration
    );

    bool IsDeviceAvailable(DeviceManagerModule.Device device);

Detailed Documentation

A driver for mobile devices.

Properties

string Name

Gets the driver name.

int DefaultSortOrder

Gets the default sort order of the driver. When the driver is loaded from the DeviceManager, the drivers are sorted by this value. The user can then change the order of the drivers in the DeviceManager.

bool IsAvailable

Gets a value indicating whether the driver is available.

DriverType DriverType

Gets the driver type.

UnityEvent<DriverEvent> OnDriverEvent

Gets the driver event.

DriverEvent instances are valid only for the duration of the event.

GameObject ScreenSticksUIPrefab

Gets the GameObject to spawn for the screen sticks. If left empty will try to load the default prefab from the resources.

float CameraRotationSpeed

Gets or sets the camera rotation speed.

float HeadHeight

Gets or sets the head’s height from the origin of the rig.

Pose LeftHandOffset

Gets or sets the offset of the left hand.

Pose RightHandOffset

Gets or sets the offset of the right hand.

Methods

void Possess(Rig rig)

Drive the rig.

Parameters:

rig

The rig to drive.

void UnPossess()

Stop driving the rig.

Parameters:

rig

The rig.

void Update(UpdatePhase updatePhase)

Update callback. Called in each update phase.

Update is called always, even if the rig is not possessed by this driver.

void Initialize()

Initializes the driver, when the driver is first loaded (The device manager starts up).

void Deinitialize()

Called right before the device manager shuts down.

bool TrySendHapticImpulse(
    DeviceManagerModule.Device device,
    float intensity,
    float duration
)

Tries to send a haptic impulse to the device.

Parameters:

device

The device.

intensity

The impulse intensity.

duration

The impulse durtation.

Returns:

true if the impulse was sent.

bool IsDeviceAvailable(DeviceManagerModule.Device device)

Checks if the device is available (There is tracking for the transform responsible for it).

Parameters:

device

The device

Returns:

true if the device is available.