Base application

nathaliamn

01-02-2011 14:20:13

Hi,

I'm trying to compile a nxogre base application mixing the 101 tutorial with a base project of ogre.

So my code is like this:
void project01::createScene(void)
{
// Create the world.
mWorld = NxOgre::World::createWorld();

mWorld->getRemoteDebugger()->connect();

// Create the scene
NxOgre::SceneDescription scene_description;
scene_description.mGravity = NxOgre::Constants::MEAN_EARTH_GRAVITY;
scene_description.mUseHardware = false;

mScene = mWorld->createScene(scene_description);

// Set default material properties
mDefaultMaterial = mScene->getMaterial(0);
mDefaultMaterial->setRestitution(0.1f);
mDefaultMaterial->setDynamicFriction(0.9);
mDefaultMaterial->setStaticFriction(0.5);

// Plane creation
mScene->createSceneGeometry(NxOgre::PlaneGeometryDescription());

// Create the rendersystem.
mRenderSystem = new Critter::RenderSystem(mScene, mSceneMgr);
mRenderSystem->createVisualDebugger();

// Setup a BodyDescription.
Critter::BodyDescription bodyDescription;
bodyDescription.mMass = 40.0f; // Set the mass to 40kg.

// Finally create the body.
mBody = mRenderSystem->createBody(NxOgre::BoxDescription(1,1,1), NxOgre::Vec3(0,5,0), "cube.1m.mesh", bodyDescription);

// create a floor mesh resource
Ogre::MeshManager::getSingleton().createPlane("floor", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Plane(Vector3::UNIT_Y, 0), 1000, 1000, 1,1 , true, 1, 1, 1, Vector3::UNIT_Z);

// create a floor entity, give it a material, and place it at the origin
Entity* floor = mSceneMgr->createEntity("Floor", "floor");
floor->setMaterialName("ground-from-nxogre.org");
floor->setCastShadows(false);
mSceneMgr->getRootSceneNode()->attachObject(floor);
}


I just got the setupPhysics() method and put on createScene()

The problem is: the gravity dont work. The box should fall down, but it is stuck.
What is the problem?

betajaen

01-02-2011 15:09:34

Are you stepping time? mWorld->advance(deltaTime); ?

nathaliamn

03-02-2011 14:31:11

Thanx! :D

I fix it and now it's working.

If anyone wants the code, just let me know, ok? :wink:

ranDLL

04-02-2011 09:31:33

Thanks for emailing that nathaliamn, just got home from work and it works like a charm, just had to delete the /* at line 113 of the *.cpp
and of course thanks betajaen :D