For our fourth PhysX tutorial, we are just going to set a couple of parameters for our SDK and our scene. These are all going to take place in our initNX function.
First off we are going to set a default skin width for objects in our scene. But first I will explain what this does. Each object has it’s own skin that goes around the object at the width of the skin depth we are going to set. This skin is used for interpenetration between objects to account for inaccuracy when stacking objects on top of each other. The skin allows the objects to penetrate each other, at the width of the skin. The width of the skin that should be needed depends on the size of the objects as it can lead to visible penetration. The default skin width is set to 0.025. To set the skin width we just use the following line after we set the Physics SDK:
gPhysicsSDK->setParameter(NX_SKIN_WIDTH, 0.01);
Next up, we are going to set the simulate mode for our program. PhysX 2.7 could run in software or use the old AGEIA PhysX Processing Unit (PPU). Those hardware/software flags are historical now, but for this tutorial we’ll explicitly choose the software simulation path:
sceneDesc.simType = NX_SIMULATION_SW;
For historical reference, PhysX 2.7 used the following flag for the AGEIA hardware path:
sceneDesc.simType = NX_SIMULATION_HW;
There are a couple of parameters covered (there are LOTS more). Check out the next tutorial for setting materials here.
Questions or corrections? If something doesn’t work or you spot something I’ve got wrong, leave a comment below. These tutorials have been around a long time, so useful corrections are always welcome!
Related posts:
5. PhysX Materials Just like we assign materials to objects in OpenGL, we...
3. PhysX Scenes PhysX, just like OpenGL, needs to be setup, but and...
2. PhysX Windows Lets attach a GLUT window do our PhysX application! ...
1 Response
[…] state, we setup our PhysX scene. Inside a scene, is where all collisions and physics are calculated.4. PhysX Parameters | SwiftlessAfter setting up a PhysX scene, you then need to assign some parameters, the parameter I will focus […]