CVR Movement Driver
Drives a Rigidbody body as a legged creature or hover vehicle. It combines a set of CVR Leg components with forward/backward/strafe speed targets, and steers via torque around the local up axis. If a CVR Seat with locked controls is found underneath, the seated player’s input is read automatically.
A Rigidbody is required on the same GameObject ([RequireComponent]).
List of CVR Legs that receive ApplyForce each physics tick. Each leg raycasts downward and adds a PID-controlled holding force to the driver’s Rigidbody.
Speed and acceleration
Section titled “Speed and acceleration”Max Forward Speed
Section titled “Max Forward Speed”Maximum forward speed in m/s. Default 10.
Max Backward Speed
Section titled “Max Backward Speed”Maximum backward speed in m/s. Default 10.
Max Sideways Speed
Section titled “Max Sideways Speed”Maximum strafing (local X) speed in m/s. Default 10.
Time To Top Speed
Section titled “Time To Top Speed”Seconds to ramp from zero to the applicable max speed. Default 2.
Time To Zero Speed
Section titled “Time To Zero Speed”Seconds to ramp back to zero after input is released. Default 1.
Steer Force
Section titled “Steer Force”Torque factor around the local up axis per unit of steering input. Default 100.
Input Accelerate
Section titled “Input Accelerate”Forward/back input in the range [-1, 1]. Negative values engage backward speed.
Input Steering
Section titled “Input Steering”Steering input in the range [-1, 1], mapped directly to torque.
Input Strafe
Section titled “Input Strafe”Sideways input in the range [-1, 1].
Use Default Car Controls
Section titled “Use Default Car Controls”When enabled and a CVR Seat with locked controls is occupied by the local player, the component reads driving input from CVRInputManager:
Input Accelerate=accelerate - brakeInput Steering=steeringInput Strafe=lookVector.xin VR,Q/Eon desktop
Behaviour
Section titled “Behaviour”Each FixedUpdate:
- Samples the Rigidbody velocity in local space.
- Calls
ApplyForceon every leg, letting each leg add its holding force. - For each axis (forward/strafe) uses one of two PID controllers (
Acfor acceleration,Brfor braking) to produce a force from the difference between the target and current speed. The controllers are clamped to[-10, 10]. - Adds the resulting force (in world space) and a steering torque around
transform.up.
Source
Section titled “Source”CVR-GameFiles/ABI.CCK.Components/CVRMovementDriver.cs