From 01ba573543980ffc058f71a363caf6d50cb30bfb Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 10 Dec 2022 17:07:28 -0600 Subject: [PATCH] rigidshape and wheeledvehicle perf work a) add more profiling for analysis b)don't bother trying to update collision if we're set to imobility or not moving fast eough for even the contact velocity tolerance threshold to trip c) updateforces and updateWheelParticles already trigger extendWheels(); . no need to do it a third time --- Engine/source/T3D/rigidShape.cpp | 6 ++++++ Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index 256dc723b..42e16b94d 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -1234,6 +1234,10 @@ collision, impact and contact forces are generated. bool RigidShape::updateCollision(F32 dt) { + PROFILE_SCOPE(RigidShape_updateCollision); + + if (mRigid.atRest || mDisableMove || (getVelocity().lenSquared() < mDataBlock->contactTol * mDataBlock->contactTol)) return false; + // Update collision information MatrixF mat,cmat; mConvex.transform = &mat; @@ -1262,6 +1266,7 @@ on standard collision resolution formulas. */ bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList) { + PROFILE_SCOPE(RigidShape_resolveCollision); // Apply impulses to resolve collision bool collided = false; for (S32 i = 0; i < cList.getCount(); i++) @@ -1314,6 +1319,7 @@ on the depth of penetration and the moment of inertia at the point of contact. */ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt) { + PROFILE_SCOPE(RigidShape_resolveContacts); // Use spring forces to manage contact constraints. bool collided = false; Point3F t,p(0,0,0),l(0,0,0); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index f912f5058..02f848714 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -799,7 +799,7 @@ void WheeledVehicle::advanceTime(F32 dt) // Stick the wheels to the ground. This is purely so they look // good while the vehicle is being interpolated. - extendWheels(); + //extendWheels(); // Update wheel angular position and slip, this is a client visual // feature only, it has no affect on the physics.