Continuous movement enhances realism and is a common feature in many VR games. Since the Meta XR SDK does not natively provide Continuous Movement functionality, it was implemented using a custom script. Below is a description of how the functionality was achieved:
How It Works?
Setting Up Movement:
The script uses Unity’s CharacterController
component to handle player movement. I also integrated it with the OVRCameraRig
to ensure that movement aligns with the player’s view direction. This way, the player moves forward, backward, or sideways based on where they’re looking.
Handling Input:
- The left joystick controls movement:
- Pushing it up or down moves the player forward or backward.
- Pushing it left or right allows strafing (side-to-side movement).
- The right joystick is used for quick turning:
- Pushing it left or right rotates the player by a fixed angle (e.g., 22.5 degrees).
Movement Logic:
The movement is calculated based on the direction of the center eye anchor (cameraRig.centerEyeAnchor
). For example:
- Forward movement follows the forward vector of the player’s view but ignores vertical movement, so the player doesn’t accidentally move upward or downward.
- Similarly, strafing uses the right vector of the camera rig.
The player’s input is combined into a single movement direction, which is then applied using the CharacterController.Move()
method.
Rotation:
To enable smooth turning, I wrote a small function that updates the player’s horizontal rotation (the Y-axis) whenever the right joystick is pushed. The angle of each turn is adjustable, so it can feel snappy or more gradual, depending on what works best.


Leave a Reply