Class RecenterOffsetManager
Access to current recenter offset, i.e. the delta between headset forward direction and vehicle forward direction.
This is relevant for headsets using 3-DoF tracking, since their tracking frame of reference is not local to the vehicle (as opposed to 6-dof), but in the same global space as the vehicle itself.
We manage this offset manually to ensure consistent compatibility across different headsets. For some there is no event to be notified when the user caused a system-driven recenter, for others there is no API to trigger a system-driven recenter.
This manages the application local recenter offset, which may be different to the global recenter offset shared across multiple applications. This is due to the fact that the application of the recenter offset depends on localization data, specifically the vehicle heading. While the vehicle heading is not available, we must operate in an application local state, to still allow users to recenter.
As such, we must be able to operate in the two states "heading available" and "heading unavailable". For the former, behavior is trivial, since we can apply new global recenter offset directly (sent from either drift mitigation, system driven user recenter logic, user recenter in other applications) and directly apply new global offset values.
The "heading unavailable" state is more complex, as it introduces the need for temporary, local recenter offset values, while still:
- keeping the last received global recenter offset so it can be applied as soon as global vehicle heading is available.
- keeping the local vehicle heading when applying a local recenter offset so we can compute the delta to the global recenter offset as soon as global vehicle heading is available.
Once global vehicle heading becomes available, we can transform the pending global or local recenter offset, depending on which one is more recent:
- local to global: add delta of local vehicle heading at time of setting local recenter offset to global vehicle heading.
- global to local: instantly apply pending global recenter offset.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
public static class RecenterOffsetManager
Properties
CurrentRecenterOffset
Gets the current applicable recenter offset.
This value may change slowly over time when applying small changes to account for headset sensor drift. Depending on the current platform, such changes are detected automatically and applied to the global recenter offset to ensure the user continues to perceive forward as the vehicle forward direction.
This value abstracts the "heading available" and "heading unavailable" states: it returns the local recenter offset while global vehicle heading is unavailable and the global recenter offset while global vehicle heading is available.
Declaration
public static float CurrentRecenterOffset { get; }
Property Value
Type | Description |
---|---|
float |
Methods
RequestUserRecenter()
This delegates recenter operation to listeners, to avoid magic lookups of e.g. the main camera here. Typically this will result in the Player component to perform a Vehicle.Recenter().
Declaration
public static void RequestUserRecenter()
UpdateRecenterOffset(float)
Updates the current recenter offset based on the current headset rotation.
Declaration
public static void UpdateRecenterOffset(float headsetToVehicle)
Parameters
Type | Name | Description |
---|---|---|
float | headsetToVehicle | The current signed delta angle between headset forward direction and vehicle forward direction. |
Events
UserRecenterPerformed
Fired when a recenter operation by a user was performed.
This can either be triggered locally via UpdateRecenterOffset(float) or via a backend / platform specific service where user recenter input is handled externally.
Declaration
public static event Action UserRecenterPerformed
Event Type
Type | Description |
---|---|
Action |
UserRecenterRequested
Fired when a recenter operation should be performed, resulting in a call to UpdateRecenterOffset(float).
This is triggered by calls to RequestUserRecenter() and when external user recenter notifications are received but no global vehicle heading offset is available. The latter is primarily relevant when in stationary mode or when no localization data is available, yet.
Declaration
public static event Action UserRecenterRequested
Event Type
Type | Description |
---|---|
Action |