Character controler Action enum help

SniperBinaire

20-06-2011 22:02:16

Well, I'm cooking with Character controller
but, I want to get my character acting in the scene like any other body.
In my setup, the character is moving, but cannot push any other entity, and can stop any other that hit him.

E.g If a 5000kg rock is thrown against me with a velocity of 10m/s, I will stop it without moving at all.
But if I run against a 1kg bloc, I'm stuck.

I've searched in the sources, but I'm stuck, I've seen the CharacterControllerAction::CharacterControllerAction_Push, but I don't know how to use it.

Any idea ?
Here is my (quite messy) code :

mNode = mRenderSystem->createNode();
mNode->createAndAttachEntity("Cube.mesh");
mNode->addMovableObject(sys0.cam); // Automatically deattaches the camera, and attaches it to itself.

Critter::AnimatedCharacterDescription bcDescription;
bcDescription.mCollisionMask = 1;
bcDescription.mMaxGroundSpeed = 100.0f;
bcDescription.mStepOffset = 0.2;
bcDescription.mShape = NxOgre::SimpleCapsule(1.6, 0.5);
bcDescription.setJumpVelocityFromMaxHeight(NxOgre::Constants::MEAN_EARTH_GRAVITY.y, 0.5);
gCharacter = mRenderSystem->createAnimatedCharacter(Vector3(125,33,300), Ogre::Radian(0), mNode, bcDescription);
character = reinterpret_cast<NxOgre::CharacterController*>(gCharacter);


// Finally move the node up a bit.
mNode->setPosition(125,33,300);
character->setPosition(Vector3(125,33,300));

// and then scale it down a a little.
mNode->setScale(0.3);
}




and the update one :
PhysX_man.character->move(mLocalTranslateVector/5);
local_player.setpos(Vector3(PhysX_man.character->getPosition().x,PhysX_man.character->getPosition().y,PhysX_man.character->getPosition().z));
sys0.cam->setOrientation(local_player.rot);

Pyritie

01-07-2011 15:04:24

look in the character controller physx lesson. There's a bunch of stuff in there about collision groups, one of them being COLLIDABLE_NON_PUSHABLE, which is what I think you want.

Controllers by definition cannot be affected by other forces (they're kinematic and are treated as if they have infinite mass) so that part of a heavy object colliding with you and stopping is already taken care of