Browse Source

Merge pull request #2339 from Areloch/MountedCollisionsFix

Adds logic to temporarily disable collisions of mounted objects on Players
Areloch 6 năm trước cách đây
mục cha
commit
0dfad8f072
1 tập tin đã thay đổi với 14 bổ sung0 xóa
  1. 14 0
      Engine/source/T3D/player.cpp

+ 14 - 0
Engine/source/T3D/player.cpp

@@ -6150,8 +6150,22 @@ void Player::updateWorkingCollisionSet()
       mWorkingQueryBox.maxExtents += twolPoint;
       mWorkingQueryBox.maxExtents += twolPoint;
 
 
       disableCollision();
       disableCollision();
+
+      //We temporarily disable the collisions of anything mounted to us so we don't accidentally walk into things we've attached to us
+      for (SceneObject *ptr = mMount.list; ptr; ptr = ptr->getMountLink())
+      {
+         ptr->disableCollision();
+      }
+
       mConvex.updateWorkingList(mWorkingQueryBox,
       mConvex.updateWorkingList(mWorkingQueryBox,
          isGhost() ? sClientCollisionContactMask : sServerCollisionContactMask);
          isGhost() ? sClientCollisionContactMask : sServerCollisionContactMask);
+
+      //And now re-enable the collisions of the mounted things
+      for (SceneObject *ptr = mMount.list; ptr; ptr = ptr->getMountLink())
+      {
+         ptr->enableCollision();
+      }
+
       enableCollision();
       enableCollision();
    }
    }
 }
 }