joaopccosta
07-12-2010 14:53:03
Hi guys!
This might be my "noobishness" about nxogre and physx in general but... i'm trying to use the PhysX Character Controller within NxOgre. I've created a capsule... all is fine but i can't seem to get the capsule to "collide" with the floor, which was made with nxogre.
It just runs through it (because of the deafult gravity). I can't get it to collide with triangle static meshes either :\
But it collides with some convex meshes i have around (some spheres).
Am i missing something? o.O
Thanks!
Character controller creation (based on the MyCharacterController used in Lesson1201 of the PhysX SDK)
frameRenderingQueued updates the character controller
updateCharacters() moves the character around
This might be my "noobishness" about nxogre and physx in general but... i'm trying to use the PhysX Character Controller within NxOgre. I've created a capsule... all is fine but i can't seem to get the capsule to "collide" with the floor, which was made with nxogre.
It just runs through it (because of the deafult gravity). I can't get it to collide with triangle static meshes either :\
But it collides with some convex meshes i have around (some spheres).
Am i missing something? o.O
Thanks!
Ogre::MeshManager::getSingleton().createPlane("floor", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::Plane(Ogre::Vector3::UNIT_Y, 0),
1000,1000,1,1,true,1,1,1, Ogre::Vector3::UNIT_Z);
Ogre::Entity* floor = mSceneMgr->createEntity("Floor", "floor");
floor->setMaterialName(name);
floor->setCastShadows(false);
mSceneMgr->getRootSceneNode()->attachObject(floor);
Character controller creation (based on the MyCharacterController used in Lesson1201 of the PhysX SDK)
gAllocator = new UserAllocator;
mManager = NxCreateControllerManager(gAllocator);
mCharacterController = new MyCharacterController(mManager,mScene->getScene(),NxVec3(0,10,0),0.8,1.5);
frameRenderingQueued updates the character controller
updateCharacters();
mScene->getScene()->simulate(evt.timeSinceLastFrame);
mScene->getScene()->flushStream();
mScene->getScene()->fetchResults(NX_RIGID_BODY_FINISHED, true);
updateCharacters() moves the character around
NxU32 collisionFlags;
NxVec3 disp = defaultGravity;
disp.x+=mX;
disp.y+=mY;
disp.z+=mZ;
mCharacterController->Move(disp,collisionFlags);
mManager->updateControllers();