Note that there are some explanatory texts on larger screens.

plurals
  1. POPhysX 3.2: Simple box dynamic are not moving
    text
    copied!<p>I've uppgraded to PhysX 3.2 and have been struggling for days to have my test box moved by gravity but it simply won't to it.</p> <p>I've followed the PhysX documentation but implemented it in my way. It's pretty much a default setup:</p> <pre><code> physx::PxSceneDesc sceneDesc = physx::PxSceneDesc((physx::PxTolerancesScale())); sceneDesc.gravity = physx::PxVec3(0.0f, -9.8f, 0.0f); if(!sceneDesc.cpuDispatcher) { physx::PxDefaultCpuDispatcher* mCpuDispatcher = physx::PxDefaultCpuDispatcherCreate(4); if(!mCpuDispatcher) LOG("PxDefaultCpuDispatcherCreate failed!"); sceneDesc.cpuDispatcher = mCpuDispatcher; } if(!sceneDesc.filterShader) sceneDesc.filterShader = &amp;physx::PxDefaultSimulationFilterShader; physxScene = physMgr-&gt;getSDK()-&gt;createScene(sceneDesc); </code></pre> <p>Creating the dynamic actor:</p> <pre><code> PxRigidDynamic* body = mPxSDK-&gt;createRigidDynamic(Convert::toPxTransform(transform)); PxRigidBodyExt::updateMassAndInertia(*body, 1.0f); mPxScene-&gt;addActor(*body); </code></pre> <p>Add the box shape:</p> <pre><code> PxBoxGeometry geometry = PxBoxGeometry(Convert::toPxVector3(size)); if(geometry.isValid()) { PxMaterial* material = api-&gt;createMaterial(0.5f, 0.5f, 0.1f); PxShape* shape = createShape(actor, geometry, material); PxRigidBodyExt::updateMassAndInertia(*body, 33.0f); } </code></pre> <p>Simulating the scene as:</p> <pre><code> float elapsedTime = float((float)mTime.getElapsedTime() / 1000.0f); mAccumulator += elapsedTime; if(mAccumulator &lt; mStepSize) { return; } else { mAccumulator -= mStepSize; mPxScene-&gt;simulate(mStepSize); mDynamicBodySys-&gt;updateGameObjectPositions(); mPxScene-&gt;fetchResults(true); mTime.restart(); } </code></pre> <p>When I look into the Visual Debugger I can see the box and the frame count increasing. But it's not moving. The actor's and the box shape seem to have the correct propeties. LinearVelocity is increasing in negative Y axis, its mass is 33 etc. But the pose is still zero/identity. What am I missing?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload