Przeglądaj źródła

Bugfix: Tweaks to physics default material and some other potential improvements

BearishSun 8 lat temu
rodzic
commit
db0d1b805e

+ 4 - 0
Source/BansheeCore/Components/BsCRigidbody.cpp

@@ -5,6 +5,7 @@
 #include "Components/BsCCollider.h"
 #include "Components/BsCCollider.h"
 #include "Components/BsCJoint.h"
 #include "Components/BsCJoint.h"
 #include "RTTI/BsCRigidbodyRTTI.h"
 #include "RTTI/BsCRigidbodyRTTI.h"
+#include "Physics/BsPhysics.h"
 
 
 using namespace std::placeholders;
 using namespace std::placeholders;
 
 
@@ -499,6 +500,9 @@ namespace bs
 #endif
 #endif
 		}
 		}
 		
 		
+		if(gPhysics()._isUpdateInProgress())
+			return;
+
 		const Transform& tfrm = SO()->getTransform();
 		const Transform& tfrm = SO()->getTransform();
 		mInternal->setTransform(tfrm.getPosition(), tfrm.getRotation());
 		mInternal->setTransform(tfrm.getPosition(), tfrm.getRotation());
 
 

+ 1 - 1
Source/BansheeCore/Components/BsCRigidbody.h

@@ -292,7 +292,7 @@ namespace bs
 		Quaternion mCMassRotation = Quaternion::IDENTITY;
 		Quaternion mCMassRotation = Quaternion::IDENTITY;
 		Vector3 mInertiaTensor = Vector3::ZERO;
 		Vector3 mInertiaTensor = Vector3::ZERO;
 		float mMass = 0.0f;
 		float mMass = 0.0f;
-		float mMaxAngularVelocity = 1.0f;
+		float mMaxAngularVelocity = FLT_MAX;
 		float mLinearDrag = 0.0f;
 		float mLinearDrag = 0.0f;
 		float mAngularDrag = 0.0f;
 		float mAngularDrag = 0.0f;
 		float mSleepThreshold = 0.0f;
 		float mSleepThreshold = 0.0f;

+ 1 - 1
Source/BansheePhysX/BsPhysX.cpp

@@ -503,7 +503,7 @@ namespace bs
 
 
 		mSimulationStep = input.timeStep;
 		mSimulationStep = input.timeStep;
 		mSimulationTime = -mSimulationStep * 1.01f; // Ensures simulation runs on the first frame
 		mSimulationTime = -mSimulationStep * 1.01f; // Ensures simulation runs on the first frame
-		mDefaultMaterial = mPhysics->createMaterial(0.0f, 0.0f, 0.0f);
+		mDefaultMaterial = mPhysics->createMaterial(1.0f, 1.0f, 0.5f);
 	}
 	}
 
 
 	PhysX::~PhysX()
 	PhysX::~PhysX()