First, here is the part of my code where I create the actors.
//1-Creating static plane
PxTransform planePos = PxTransform(PxVec3(0.0f),PxQuat(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f))); //Position and orientation(transform) for plane actor
PxRigidStatic* plane = gPhysicsSDK->createRigidStatic(planePos); //Creating rigid static actor
plane->createShape(PxPlaneGeometry(), *material); //Defining geometry for plane actor
gScene->addActor(*plane); //Adding plane actor to PhysX scene
int numberofblocks=50;
PxVec3 offset = PxVec3(0,1,0);
PxReal radius=1;
PxReal height=1;
//initialize a chain
PxTransform boxPos(PxVec3(0.0f, 1.0f, 0.0f),PxQuat(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f))); //Position and orientation(transform) for box actor
PxRigidDynamic *gBoxOri = NULL; //Instance of box actor
PxCapsuleGeometry sphereGeometry(radius,height); //Defining geometry for box actor
gBoxOri = PxCreateDynamic(*gPhysicsSDK, boxPos, sphereGeometry, *material, 1.0f); //Creating rigid static actor
gScene->addActor(*gBoxOri); //Adding box actor to PhysX scene
for (PxU32 i=1; i<numberofblocks; i++)
{
PxTransform boxPos(PxVec3(0.0f, 2*i*2.0f, 0.0f)); //Position and orientation(transform) for box actor
PxRigidDynamic *gBox = NULL; //Instance of box actor
PxSphereGeometry sphereGeometry(radius); //Defining geometry for box actor
gBox = PxCreateDynamic(*gPhysicsSDK, boxPos, sphereGeometry, *material, 1.0f); //Creating rigid static actor
gScene->addActor(*gBox); //Adding box actor to PhysX scene
// adding some joint to the mix
//PxSphericalJoint* joint = PxSphericalJointCreate(*gPhysicsSDK, gBoxOri, PxTransform(-offset), gBox, PxTransform(offset));
gBoxOri=gBox;
cout<< i <<"\n";
}
When I visualize the simulation in the PVD, I see the spheres falling down as expected. Piling up.
The funny thing is while they spread after bouncing, they appear to only move in the X,Z plane completely ignoring the Y dimension.
By replacing the spheres by cubes, the objects explore in X,Y and Z.
Can anyone tell me if PhysX is supposed to act like this with spheres?