Hi.
I’m trying to update my code to use the latest version of the PhysX SDK (version 3.2).
I’ve managed to load an actor from a .RepX file (exported from Max), but it doesn’t seem to import the actor’s name. When I run the following code, it all works and it prints out the name of the plane, but the name of the imported object is blank.
// Create Plane ---------------------------------------------------
PxTransform pose = PxTransform(PxVec3(0.0f, 0, 0.0f),PxQuat(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f)));
PxRigidStatic* plane = mPhysics->createRigidStatic(pose);
PxShape* shape = plane->createShape(PxPlaneGeometry(), *mMaterial);
plane->setName("PLANE");
mScene->addActor(*plane);
// Load from RepX file
PxDefaultFileInputData data("test.repx");
PxCollection* bufferCollection = mPhysics->createCollection();
PxCollection* sceneCollection = mPhysics->createCollection();
PxStringTable* stringTable = NULL;
RepXErrorCode::Enum errorCode = deserializeFromRepX(data, *mPhysics, *mCooking, stringTable, NULL, *bufferCollection, *sceneCollection);
mPhysics->addCollection(*bufferCollection, *mScene);
mPhysics->addCollection(*sceneCollection, *mScene);
bufferCollection->release();
sceneCollection->release();
unsigned int numActors = mScene->getNbActors(PxActorTypeSelectionFlag::eRIGID_STATIC | PxActorTypeSelectionFlag::eRIGID_DYNAMIC);
PxActor** actors = new PxActor*[numActors];
mScene->getActors(PxActorTypeSelectionFlag::eRIGID_STATIC | PxActorTypeSelectionFlag::eRIGID_DYNAMIC, actors, numActors);
for (unsigned int i(0); i < numActors; i++)
{
PxActor* actor = actors[i];
const char* actorName = actor->getName();
OutputDebugStringA("Actor Name: ");
OutputDebugStringA(actorName);
OutputDebugStringA("
");
}
Does anyone know how to get it to set the actor’s name when it imports the file? I’m sort of guessing it has something to do with the PxStringTable, but I’m not sure how to create or use it…