Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void FixedUpdate(){
- float motor = maxMotorTorque * Input.GetAxis("Vertical");
- float steering = maxSteeringAngle * Input.GetAxis("Horizontal");
- foreach (AxleInfo axleInfo in axleInfos) {
- if (axleInfo.leftWheel != null){
- if (axleInfo.steering) {
- axleInfo.leftWheel.steerAngle = steering;
- }
- if (axleInfo.motor) {
- axleInfo.leftWheel.motorTorque = motor;
- }
- ApplyLocalPositionToVisuals(axleInfo.leftWheel);
- }
- if (axleInfo.rightWheel != null){
- if (axleInfo.steering) {
- axleInfo.rightWheel.steerAngle = steering;
- }
- if (axleInfo.motor) {
- axleInfo.rightWheel.motorTorque = motor;
- }
- ApplyLocalPositionToVisuals(axleInfo.rightWheel);
- }
- }
- }
Add Comment
Please, Sign In to add comment