Sign in to follow this  
Davita

Several newbie questions for Physx 3

Recommended Posts

Hello Everyone. This is my first post here [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

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:


[CODE]
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);
}
[/CODE]
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 [CODE]sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f);[/CODE], what value should I provide to get a real gravity, the one we have on earth [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

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 [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Thank you very much everyone. I appreciate your help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this