Guest User

Untitled

a guest
May 25th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public void FixedUpdate(){
  2. float motor = maxMotorTorque * Input.GetAxis("Vertical");
  3. float steering = maxSteeringAngle * Input.GetAxis("Horizontal");
  4.  
  5. foreach (AxleInfo axleInfo in axleInfos) {
  6. if (axleInfo.leftWheel != null){
  7. if (axleInfo.steering) {
  8. axleInfo.leftWheel.steerAngle = steering;
  9. }
  10. if (axleInfo.motor) {
  11. axleInfo.leftWheel.motorTorque = motor;
  12. }
  13. ApplyLocalPositionToVisuals(axleInfo.leftWheel);
  14. }
  15.  
  16. if (axleInfo.rightWheel != null){
  17. if (axleInfo.steering) {
  18. axleInfo.rightWheel.steerAngle = steering;
  19. }
  20. if (axleInfo.motor) {
  21. axleInfo.rightWheel.motorTorque = motor;
  22. }
  23. ApplyLocalPositionToVisuals(axleInfo.rightWheel);
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment