瀏覽代碼

Wake up the wheel rigidbodies when steering.

Lasse Öörni 12 年之前
父節點
當前提交
1c83fc8cd4
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Bin/Data/Scripts/Vehicle.as

+ 7 - 0
Bin/Data/Scripts/Vehicle.as

@@ -381,6 +381,13 @@ class Vehicle : ScriptObject
         frontLeftAxis.otherAxis = steeringRot * Vector3(-1, 0, 0);
         frontLeftAxis.otherAxis = steeringRot * Vector3(-1, 0, 0);
         frontRightAxis.otherAxis = steeringRot * Vector3(1, 0, 0);
         frontRightAxis.otherAxis = steeringRot * Vector3(1, 0, 0);
 
 
+        // When steering, wake up the wheel rigidbodies so that their orientation is updated
+        if (newSteering != 0.0)
+        {
+            frontLeftDrive.Activate();
+            frontRightDrive.Activate();
+        }
+
         if (accelerator != 0.0)
         if (accelerator != 0.0)
         {
         {
             // Torques are applied in world space, so need to take the vehicle & wheel rotation into account
             // Torques are applied in world space, so need to take the vehicle & wheel rotation into account