moving character with NxOgre 0.9 and PhysX 2.7.3

Djoef

15-09-2008 18:55:55

Hi,

I got NxOgre & PhysX installed and want to move a character.
Problem is that I read different ways to do that on the forum.

Please could someone tell me what is the correct way ?

1) moving forward / backward
mSubject->addMovement(NxOgre::Character::DR_Forward); Seems to be working, but I would like to make the speed depend on the joystick axis value.
In Ogre I tried it do do it this way :
camNode->translate(camNode->getOrientation()*Ogre::Vector3(0,0,joy.mAxes[2].abs/32000.0));

How should I get the joystick-value integrated so the speed is influenced ?

2) turning
camNode->yaw(Ogre::Degree(-joy.mAxes[2].abs/5000));
mSubject->setDirection(camNode->getOrientation());

Seems to do well, but I'm unsure if that is the "right" way to do it.


Thank you !

Prophet

15-09-2008 20:49:41

If I understood you right, can't you take something like (I'm not so familiar with joysticks)mActor->setLinearVelocity(stickPushed*maxSpeed) (where stickPushed is how much from 0 to 1 how far the stick is pushed forward). Getting the idea I'm after?

Djoef

16-09-2008 18:20:26

The problem is that mSubject is a character, and I cannot use setLinearVelocity.

mSubject->getNxController()->getActor()->setLinearVelocity(NxVec3(0,0,1));
doesn't seem to do something.

mSubject->getNxController()->move(NxVec3(-0.4,0.0,0.0),0,0.01f,collisionFlags,sharpness);
seems to do something, but I go through the groundplane once I start to move.

Any hints how to do this the correct way ?
I would like to have continuous collision detection.

greetz,
g

betajaen

16-09-2008 18:26:04

The Character doesn't collide with the ground plane; it's a bug or a feature with PhysX (I can't decide which) and CCD won't happen with Kinematic objects.

Djoef

16-09-2008 18:53:28

actually its not "the ground plane" but rather the ground plane of my static mesh.

How should I move my character betajaen ?
Or should I use an actor/body instead ?

thanks !