VZPlayer Interface
VZPlayer is our high-level player controller, that translates VZController into comfortable VR motion with our custom physics.
Here's a quick rundown on VZPlayer motion parameters:
- Camera - player camera to control (if null defaults to MainCamera)
- HUD - gameobject that will be kept vertical and in front of the player
- DraftSpeed - target speed to go (zero disables drafting)
- DraftFactor - ratio of Controller.InputSpeed to DraftSpeed beyond which drafting stops
- SpeedFudge - makes you go faster or slower
- UphillFactor - how much slower you go up hills
- DownhillFactor - how much faster you go down hills
- MaxVertSpeed - limits your upward (climbing) and downward (falling) velocity
- MaxTurn - maximum turn amount
- LeanFudge - turns you more or less with your lean
- LeanIn - how much your avatar rotates when swerving
- LandingHardness - how hard you come down on the ground. Lower values make a softer landing that takes effect sooner
- LandingRadius - distance from VZPlayer origin that you want to touch ground softly. Set this smaller than your collision volume to feel the ground more. If you set this larger than your collision volume you will never reach the ground!
- NeckHeight - distance above VZPlayer origin of your virtual neck. Note that the VZPlayer rotates about its origin, while your neck is always kept vertical
- AllowRotate - set false to only allow strafing with your leaning, ignores your head look
- AllowRoll - set true to allow the VZPlayer to roll about the forward axis in response to terrain
- AllowDrift - set true to maintain your velocity in the air even when you stop pedaling
- BodyPrefab - should always be set to VZController.prefab or similar structure (contains required GameObjects)
- NearClipPlane - near plane of VR camera
- FarClipPlane - far plane of VR camera
- SlowRotateLimit - amount to limit your turning when you are stopped
- Reverse - put VZPlayer into reverse
Adding VZPlayer to a game object will cause your pedaling and leaning to move that game object. Your game object will also need a physics Collider and Rigidbody components to behave correctly. VZPlayer will also make the Camera a child of the game object to be moved around with it.
If your collider objects do not encompass the origin of your VZPlayer, you will need to change their layer to "Ignore Raycast". Otherwise, you may experience unintentional "jumping" behavior as VZPlayer raycasts downward to determine its height above the ground in order to soften landings, and may hit its own colliders instead.
Script code can access your VZPlayer anywhere like VZPlayer.Instance.