I'm investigating the PhysX now, and I've stuck on the serialization. When I'm trying to serialize a joint, the deserialization fails with error:
code: 8
message: NpActorTemplate::resolvePointers: connector not found.
file: ..\..\PhysX\src\NpActor.cpp
line: 95
But without the joint it works fine and deserializes all the objects. Are there any additional actions required to serialize joint properly? There is a serialization part of code:
material1->collectForExport(*collection);
material->collectForExport(*collection);
mesh->collectForExport(*collection);
for (__int8 i = 0; i < 4; ++i)
{
actors[i]->collectForExport(*collection);
aggregate->addActor(*actors[i]);
}
aggregate->collectForExport(*collection);
joints[0] = PxD6JointCreate(*physics, actors[0], PxTransform(PxVec3(2, -.5f, 0)), actors[1], PxTransform(PxVec3(0)));
PxD6JointDrive drive(1000, 100, PX_MAX_F32, true);
joints[0]->setMotion(PxD6Axis::eX, PxD6Motion::eFREE);
joints[0]->setMotion(PxD6Axis::eY, PxD6Motion::eFREE);
joints[0]->setMotion(PxD6Axis::eZ, PxD6Motion::eFREE);
joints[0]->setDrive(PxD6Drive::eX, drive);
joints[0]->setDrive(PxD6Drive::eY, drive);
joints[0]->setDrive(PxD6Drive::eZ, drive);
joints[0]->setDrivePosition(PxTransform(PxVec3(2, -.5f, 0)));
joints[0]->setDriveVelocity(PxVec3(0), PxVec3(0));
for (__int8 i = 0; i < 1; ++i)
{
joints[i]->collectForExport(*collection);
}
Deserialization:
_pxBuffer = _aligned_malloc(length, PX_SERIAL_FILE_ALIGN);
//filling the buffer here
_pxCollection = pxContext->GetPhysics()->createCollection();
_pxCollection->deserialize(_pxBuffer, 0, 0);