Several newbie questions for Physx 3

Started by
-1 comments, last by Davita 11 years, 9 months ago
Hello Everyone. This is my first post here smile.png

Today, I tried to play around Physx and Physx visual debugger and as always, newbies have problems and questions. I'll try to describe my problems as best as I can with my poor english skills.

1) I managed to create a physx scene. added a dynamic actor and manipulated it. I see in Visual Debugger it's motion. It's a standard PxSphereGeometry ball. However, when I add a second ball in the scene, the second one is not visible, but I can see that collision happens. Here's the code and if anyone can point me what's wrong with it I'd be very grateful:



PxMaterial* mMaterial;

mMaterial = mPhysics->createMaterial(0.5f, 0.5f, 0.5f); //static friction, dynamic friction, restitution

if(!mMaterial)
error("createMaterial failed!");

PxVec3 position(0, 50, 0);
PxRigidDynamic* aSphereActor = PxCreateDynamic(*mPhysics, PxTransform(position), PxSphereGeometry(3), *mMaterial, 1.f);
PxRigidDynamic* aTrActor = PxCreateDynamic(*mPhysics, PxTransform(PxVec3(3, 1, 1)), PxSphereGeometry(3), *mMaterial, 1.1f);

if(!aSphereActor)
error("Unable to create sphere actor");

aSphereActor->setMass(1);

aTrActor->setMass(10);

PxRigidStatic* plane = PxCreatePlane(*mPhysics, PxPlane(PxVec3(0,1,0), 0), *mMaterial);
if (!plane)
error("create shape failed!");

mScene->addActor(*plane);
mScene->addActor(*aSphereActor);
mScene->addActor(*aTrActor);


while(true)
{
mScene->simulate(1.0f / 30.0f);
if(!mScene->fetchResults(true))
error("cant fetch result");
Sleep(10);
}

In this scene, aSphereActor collides with aTrActor, but I can't see aTrActor in Visual Debugger, however collision is perfectly visible.

2) Nvidia's documentation is very very poor. It's a torture for newbies like me to find it's way through it. So I wanted to know how can I import a 3d model and add it in the scene. I know there is a Physx plugins for 3ds max, maya etc. Say I have a model exported with this plugin, how can I import it in my app and add it to the scene?

3) During the creation of the scene sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f);, what value should I provide to get a real gravity, the one we have on earth smile.png

4) I can assign a mass to an actor, however I don't know in which measurement unit the mass is. For example, if I set aSphereActor->setMass(1); will aSphereActor will be 1kg, gram or what?

For now that's it. I'll ask again if I'll need more info smile.png

Thank you very much everyone. I appreciate your help.

This topic is closed to new replies.

Advertisement