Just in case someone is interested, here is my code , pretty much all take from the first sample in the SDK.
this initializes all the physics stuff
void cAWPhysics::Initialize()
{
bool recordMemoryAllocations = true;
const bool useCustomTrackingAllocator = true;
PxAllocatorCallback* allocator = &gDefaultAllocatorCallback;
if(useCustomTrackingAllocator)
allocator = GetAWAllocator(); //optional override that will track memory allocations
mpPxFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, *allocator, GetAWErrorCallback());
if(!mpPxFoundation)
{
AWAssertMsg(false, "PxCreateFoundation failed!");
return;
}
mpPxProfileZoneManager = &PxProfileZoneManager::createProfileZoneManager(mpPxFoundation);
if(!mpPxProfileZoneManager)
{
AWAssertMsg(false, "PxProfileZoneManager::createProfileZoneManager failed!");
return;
}
mpPxPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *mpPxFoundation, PxTolerancesScale(), recordMemoryAllocations, mpPxProfileZoneManager);
//mpPxPhysics = PxCreateBasePhysics(PX_PHYSICS_VERSION, *mpPxFoundation, PxTolerancesScale());
if(!mpPxPhysics)
{
AWAssertMsg(false, "PxCreatePhysics failed!");
return;
}
if(GetOrCreateProfileZone(*mpPxFoundation))
{
mpPxProfileZoneManager->addProfileZone(*GetOrCreateProfileZone(*mpPxFoundation));
}
if(!PxInitExtensions(*mpPxPhysics))
{
AWAssertMsg(false, "PxInitExtensions failed!");
return;
}
PxTolerancesScale toleranceScale;
mpPxCooking = PxCreateCooking(PX_PHYSICS_VERSION, *mpPxFoundation, PxCookingParams(toleranceScale));
if(!mpPxCooking)
{
AWAssertMsg(false, "PxCreateCooking failed!");
return;
}
#ifdef AW_DEBUG_BUILD
if(mpPxPhysics->getPvdConnectionManager())
{
mpPxPhysics->getPvdConnectionManager()->addHandler(*this);
}
#endif
// setup default material...
mpDefaultMaterial = new sAWPhysicsMaterial();
mpDefaultMaterial->friction = 0.5f;
mpDefaultMaterial->FrictionCombineMode = 0;
mpDefaultMaterial->Restitution = 0.1f;
mpDefaultMaterial->Density = 1.0f;
mpDefaultMaterial->RaiseMassToPower = 1.0f;
mpPxDefaultMaterial = mpDefaultMaterial->GetPxMaterial();
if(!mpPxDefaultMaterial)
{
AWAssertMsg(false, "createMaterial failed!");
return;
}
mpPxCpuDispatcher = PxDefaultCpuDispatcherCreate(mNbThreads);
if(!mpPxCpuDispatcher)
{
AWAssertMsg(false, "PxDefaultCpuDispatcherCreate failed!");
return;
}
}
then I initialize my scene
void cAWPhysicsScene::Initialize()
{
cAWPhysics* pAWPhysics = cAWPhysics::Get();
PxPhysics* pPxPhysics = pAWPhysics->GetPhysics();
PX_ASSERT(NULL == mpPxScene);
PxSceneDesc sceneDesc(pPxPhysics->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f);
sceneDesc.cpuDispatcher = pAWPhysics->GetPxDefaultCpuDispatcher();
sceneDesc.filterShader = PxDefaultSimulationFilterShader;
sceneDesc.flags |= PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
mpPxScene = pPxPhysics->createScene(sceneDesc);
if(!mpPxScene)
{
AWAssertMsg(false, "PhysX: createScene failed!");
return;
}
mpPxScene->setVisualizationParameter(PxVisualizationParameter::eSCALE, 1.0f);
mpPxScene->setVisualizationParameter(PxVisualizationParameter::eCOLLISION_SHAPES, 1.0f);
}
and here is where i update the scene
void cAWPhysicsScene::Update(float dt)
{
static float stepSize = 1.0f / 60.0f;
mpPxScene->lockWrite();
mpPxScene->simulate(stepSize);
mpPxScene->unlockWrite();
mpPxScene->fetchResults(true);
}
my code gets stuck on “mpPxScene->simulate(stepSize);”
but in the VDO i can see my scene just nothing moves.