Allow for zero mass rigid body

This commit is contained in:
Daniel Chappuis 2016-05-18 21:39:11 +02:00
parent 6a8b63adc2
commit ae7bec43c4

View File

@ -213,8 +213,6 @@ ProxyShape* RigidBody::addCollisionShape(CollisionShape* collisionShape,
const Transform& transform, const Transform& transform,
decimal mass) { decimal mass) {
assert(mass > decimal(0.0));
// Create a new proxy collision shape to attach the collision shape to the body // Create a new proxy collision shape to attach the collision shape to the body
ProxyShape* proxyShape = new (mWorld.mMemoryAllocator.allocate( ProxyShape* proxyShape = new (mWorld.mMemoryAllocator.allocate(
sizeof(ProxyShape))) ProxyShape(this, collisionShape, sizeof(ProxyShape))) ProxyShape(this, collisionShape,
@ -348,8 +346,8 @@ void RigidBody::recomputeMassInformation() {
mMassInverse = decimal(1.0) / mInitMass; mMassInverse = decimal(1.0) / mInitMass;
} }
else { else {
mInitMass = decimal(1.0); mCenterOfMassWorld = mTransform.getPosition();
mMassInverse = decimal(1.0); return;
} }
// Compute the center of mass // Compute the center of mass