made some progress in saving and restoring the state during the simulation, with identical results.
Option to de/serialize btPersistentContactManifolds and fix lossy conversion during btMultiBody de/serialization of base world transform (serialize the quaternion, not the converted 3x3 matrix) There are still several caches not taken into account, and btMultiBody links/constraints are not deserialized yet etc. See examples\pybullet\examples\saveRestoreState.py for an example.
This commit is contained in:
@@ -16,6 +16,7 @@ subject to the following restrictions:
|
||||
|
||||
#include "btCollisionObject.h"
|
||||
#include "LinearMath/btSerializer.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
|
||||
btCollisionObject::btCollisionObject()
|
||||
: m_interpolationLinearVelocity(0.f, 0.f, 0.f),
|
||||
@@ -114,10 +115,18 @@ const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* seriali
|
||||
dataOut->m_ccdSweptSphereRadius = m_ccdSweptSphereRadius;
|
||||
dataOut->m_ccdMotionThreshold = m_ccdMotionThreshold;
|
||||
dataOut->m_checkCollideWith = m_checkCollideWith;
|
||||
|
||||
// Fill padding with zeros to appease msan.
|
||||
memset(dataOut->m_padding, 0, sizeof(dataOut->m_padding));
|
||||
|
||||
if (m_broadphaseHandle)
|
||||
{
|
||||
dataOut->m_collisionFilterGroup = m_broadphaseHandle->m_collisionFilterGroup;
|
||||
dataOut->m_collisionFilterMask = m_broadphaseHandle->m_collisionFilterMask;
|
||||
dataOut->m_uniqueId = m_broadphaseHandle->m_uniqueId;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataOut->m_collisionFilterGroup = 0;
|
||||
dataOut->m_collisionFilterMask = 0;
|
||||
dataOut->m_uniqueId = -1;
|
||||
}
|
||||
return btCollisionObjectDataName;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user