API reference

OVRPlayerController Class

Extends MonoBehaviour
Controls the player's movement in virtual reality.

Fields

float Acceleration[Get]
The rate acceleration during movement.
float Damping[Get]
The rate of damping on movement.
float BackAndSideDampen[Get]
The rate of additional damping when moving sideways or backwards.
float JumpForce[Get]
The force applied to the character when jumping.
float RotationAmount[Get]
The rate of rotation when using a gamepad.
float RotationRatchet[Get]
The rate of rotation when using the keyboard.
bool SnapRotation[Get]
The player will rotate in fixed steps if Snap Rotation is enabled.
bool RotateAroundGuardianCenter[Get]
[Deprecated] When enabled, snap rotation will happen about the guardian rather than the player/camera viewpoint.
int FixedSpeedSteps[Get]
How many fixed speeds to use with linear movement? 0=linear control.
bool HmdResetsY[Get]
If true, reset the initial yaw of the player controller when the Hmd pose is recentered.
bool HmdRotatesY[Get]
If true, tracking data from a child OVRCameraRig will update the direction of movement.
float GravityModifier[Get]
Modifies the strength of gravity.
bool useProfileData[Get]
If true, each OVRPlayerController will use the player's physical height.
float CameraHeight[Get]
The CameraHeight is the actual height of the HMD and can be used to adjust the height of the character controller, which will affect the ability of the character to move into areas with a low ceiling.
bool Teleported[Get]
This bool is set to true whenever the player controller has been teleported.
It is reset after every frame. Some systems, such as CharacterCameraConstraint, test this boolean in order to disable logic that moves the character controller immediately following the teleport.
bool EnableLinearMovement[Get]
When true, user input will be applied to linear movement.
Set this to false whenever the player controller needs to ignore input for linear movement.
bool EnableRotation[Get]
When true, user input will be applied to rotation.
Set this to false whenever the player controller needs to ignore input for rotation.
bool RotationEitherThumbstick[Get]
Rotation defaults to secondary thumbstick.
You can allow either here. Note that this won't behave well if EnableLinearMovement is true.

Events

Action< Transform > TransformUpdated
This event is raised after the character controller is moved.
This is used by the OVRAvatarLocomotion script to keep the avatar transform synchronized with the OVRPlayerController.
Action CameraUpdated
This event is raised immediately after the camera transform has been updated, but before movement is updated.
Action PreCharacterMove
This event is raised right before the character controller is actually moved in order to provide other systems the opportunity to move the character controller in response to things other than user input, such as movement of the HMD.
See CharacterCameraConstraint.cs for an example of this.

Protected Fields

CharacterController Controller[Get]
OVRCameraRig CameraRig[Get]

Properties

float InitialYRotation[Get]

Protected Functions

virtual void UpdateController ( )

Member Functions

virtual void UpdateMovement ( )
void UpdateTransform
( OVRCameraRig rig )
Invoked by OVRCameraRig's UpdatedAnchors callback.
Allows the Hmd rotation to update the facing direction of the player.
bool Jump ( )
Jump! Must be enabled manually.
void Stop ( )
Stop this instance.
void GetMoveScaleMultiplier
( ref float moveScaleMultiplier )
Gets the move scale multiplier.
Parameters
moveScaleMultiplier
Move scale multiplier.
void SetMoveScaleMultiplier
( float moveScaleMultiplier )
Sets the move scale multiplier.
Parameters
moveScaleMultiplier
Move scale multiplier.
void GetRotationScaleMultiplier
( ref float rotationScaleMultiplier )
Gets the rotation scale multiplier.
Parameters
rotationScaleMultiplier
Rotation scale multiplier.
void SetRotationScaleMultiplier
( float rotationScaleMultiplier )
Sets the rotation scale multiplier.
Parameters
rotationScaleMultiplier
Rotation scale multiplier.
void GetSkipMouseRotation
( ref bool skipMouseRotation )
Gets the allow mouse rotation.
Parameters
skipMouseRotation
Allow mouse rotation.
void SetSkipMouseRotation
( bool skipMouseRotation )
Sets the allow mouse rotation.
Parameters
skipMouseRotation
If set to true allow mouse rotation.
void GetHaltUpdateMovement
( ref bool haltUpdateMovement )
Gets the halt update movement.
Parameters
haltUpdateMovement
Halt update movement.
void SetHaltUpdateMovement
( bool haltUpdateMovement )
Sets the halt update movement.
Parameters
haltUpdateMovement
If set to true halt update movement.
void ResetOrientation ( )
Resets the player look rotation when the device orientation is reset.