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 :
and the update one :
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);