Problem with character

Fede89

27-12-2007 18:40:29

hi! I'm new to NxOgre and I have a problem with my character.

First of all i create my world and scene

NxOgre::PhysXDriverParams params;
params.logtype = NxOgre::PhysXDriverParams::LT_TEXT;
params.useFrameListener = true;
World* mWorld = new World(params);
Scene* mScene = mWorld->createScene("Main",mSceneMgr, "gravity: 0 -9.8 0, floor: no");


after that I create 2 body, one for my terrain and another only to see the gravity.

NxOgre::Body *body = mScene->createBody( "chiosco.mesh", new NxOgre::TriangleMeshShape("terrain.mesh"),Vector3(0,0,0), "static: yes" );

NxOgre::Body *body2 = mScene->createBody ( "test.mesh", new NxOgre::ConvexShape( "prova.mesh"),Vector3(0,30,0), "mass: 100" );


and the I create my character

NxOgre::CharacterParams characterParams;
characterParams.setToDefault();
characterParams.mDimensions.set( NxVec3( size.x, size.y, size.z) );
characterParams.mType = NxOgre::CharacterParams::CT_Capsule;

NxOgre::Character*player = mScene->createCharacter("Player",NxOgre::Pose(Vector3(0,0,250),Quaternion::IDENTITY),characterParams);
player->createNode();
Entity* ent = mSceneMgr->createEntity("man","man.mesh");
player->getNode()->attachObject(ent);
player->getNode()->setScale(Vector3(10,10,10));


and in the frame listener I write

if(mKeyboard->isKeyDown(KC_UP))
player->addMovement(NxOgre::Character::DR_Forward);

if(mKeyboard->isKeyDown(KC_DOWN))
player->addMovement(NxOgre::Character::DR_Backward);

if(mKeyboard->isKeyDown(KC_LEFT))
player->addMovement(NxOgre::Character::DR_StepLeft);

if(mKeyboard->isKeyDown(KC_RIGHT))
player->addMovement(NxOgre::Character::DR_StepRight);


so nothing special...
now if i run mu application from MSVC ide all works well, i can move my character and the non static body has gravity.

if i run the application outside the ide the body has gravity but i cannot move my body, and hasn't got gravity as well...

can anyone help me?

betajaen

27-12-2007 18:55:20

Are you sure the both of your applications you launch are the same file?

Fede89

27-12-2007 19:00:03

yes! of course...
I'm using NxOgre 0.9-38 with PhysX 2.7.3 Ogre 1.5.0 and Platform Windows Vista.

if I try another version of ogre can change anything?

betajaen

27-12-2007 19:50:05

No that isn't the reason. Are you sure they are both Debug/Debug or Release/Release?

Fede89

28-12-2007 13:44:40

yes...
with ogre version 1.4.6, in debug mode all work but with release mode if i run my application outside the ide i cannot move the character

taikuri

08-01-2008 07:26:32

I'm having exactly the same problem.

This is probably related to error in PhysX.

see post "Character gets stuck" for more details, http://www.ogre3d.org/phpBB2addons/view ... =character

So I think there's not much more to do than post a ticket to Ageia?

denreaper

08-01-2008 16:30:31

Maybe look on page 2 of that thread at how I resolved mine... It's a little bit hacky but it works perfectly for me.

BonD

09-01-2008 21:36:18

Hi, I've built a simple application with a 3rd person camera, a floor, some dynamic bodies and a character.
My floor is 2m thick and it was set to the position 0,-2,0.
I put my bodies and my Character to about 300m high to fall down...

However, my Character has some problem with its bounding box. All the other bodies are landing correctly to the floor, but my Character stops before the floor and then walks about 10 meters above it.

I've tried to configure the dimensions but only with "dimensions: x 1 z" works correctly. I guess my Character is about 60-70 meters high but as I increase the Y part of the dimensions, the Character is starting to raise.
(but if I'm using x 1 z, then insted of a bounding box I get a bounding plane of course...)

I'm using the ninja.mesh and I have absolutely no idea about what causes this mysterius problem.

What should I do?

betajaen

09-01-2008 21:57:21

The ninja mesh is huge; it's like 100metres big. You should use a scaled cube until you get a better model, or at least scale the ninja to it's correct size.

taikuri

10-01-2008 06:03:29

betajaen, did you post ticket of this 'character stuck' problem to ageia earlier? At least you said something like that in the other post.

It'd be good if Ageia would fix the problem. In this way there wouldn't be any nasty hacks lying around :)

betajaen

10-01-2008 11:05:30

No I forgot. I've been very busy lately.

Fede89

26-01-2008 18:28:52

now all works. if i create the character before the first body or after the second body it doesn't move but if i create the character after the first body all works....