diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index d6c86096b..33e7468eb 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -7482,7 +7482,8 @@ bool PhysicsServerCommandProcessor::processRequestActualStateCommand(const struc serverCmd.m_sendActualStateArgs.m_rootLocalInertialFrame[6] = body->m_rootLocalInertialFrame.getRotation()[3]; - btVector3 center_of_mass(sb->getCenterOfMass()); + btVector3 center_of_mass(sb->getCenterOfMass()); + sb->updateTransform(); btTransform tr = sb->getWorldTransform(); //base position in world space, cartesian stateDetails->m_actualStateQ[0] = center_of_mass[0]; diff --git a/src/BulletSoftBody/btSoftBody.cpp b/src/BulletSoftBody/btSoftBody.cpp index 896bba3df..8faef092c 100644 --- a/src/BulletSoftBody/btSoftBody.cpp +++ b/src/BulletSoftBody/btSoftBody.cpp @@ -1034,6 +1034,12 @@ void btSoftBody::setAngularVelocity(const btVector3& angVel) } } +// +void btSoftBody::updateTransform() +{ + setWorldTransform(getRigidTransform()); +} + // btTransform btSoftBody::getRigidTransform() { diff --git a/src/BulletSoftBody/btSoftBody.h b/src/BulletSoftBody/btSoftBody.h index 7e4aeec8e..1b8f3905f 100644 --- a/src/BulletSoftBody/btSoftBody.h +++ b/src/BulletSoftBody/btSoftBody.h @@ -819,8 +819,6 @@ public: btAlignedObjectArray m_clusterConnectivity; //cluster connectivity, for self-collision - btTransform m_worldTransform; - btVector3 m_windVelocity; btScalar m_restLengthScale; @@ -972,6 +970,8 @@ public: void setLinearVelocity(const btVector3& linVel); /* Set the angular velocity of the center of mass */ void setAngularVelocity(const btVector3& angVel); + /* Update the world transform to the best fit rigid transform */ + void updateTransform(); /* Get best fit rigid transform */ btTransform getRigidTransform(); /* Transform to given pose */