void PhysX3::CreateCube(ENTITY * ent, const PxVec3& pos, int body, PxVec3& TempScale)
{
PX_ASSERT(0 != gScene);
PxVec3 vec_min,vec_max;
GetMinMax(ent,vec_min,vec_max);
PxMaterial* mMaterial = gPhysicsSDK->createMaterial(1.0,1.0,1.0);
// Setting up the Dimensions
PxVec3 dimensions = (vec_max-vec_min)/2;
dimensions.x *= TempScale.x;
dimensions.y *= TempScale.y;
dimensions.z *= TempScale.z;
PxBoxGeometry geometry(dimensions);
PxReal density = 1.0f;
PxTransform transform(PxVec3(pos.x, pos.y, pos.z)* PXSize, PxQuat::createIdentity());
PxRigidDynamic *actor = PxCreateDynamic(*gPhysicsSDK, transform, geometry, *mMaterial, density);
actor->setAngularDamping(0.75);
actor->setLinearVelocity(PxVec3(0,0,0));
if (!actor)
error("create actor failed!");
box = actor;
// Save the entity's index to the userData of the shape
box->userData = (long*)ent->link.index;
mPhysicsActors.push_back(box);
PxU32 nShapes = box->getNbShapes();
PxShape** shapes = new PxShape*[nShapes];
box->getShapes(shapes, nShapes);
PxTransform pT = transform;
pT.p = PXSize * pos;
PxBoxGeometry bg = geometry;
PxMat33 pose = PxMat33(pT.q );
float mat[16];
getColumnMajor(pose,pT.p, mat);
ang_to_matrix((ANGLE*)&(ent->pan),&(mat[0]));
box->setDominanceGroup(1);
PX_ASSERT(box->isValid());
gScene->addActor(*box);
}