Tryinng character controller with Buggy Swires, help need

mamairaja

08-01-2011 06:21:43

Probably I am wrong in the code. So need a help

Here I want to implement character controller. I have this code.



Critter::BackgroundCharacterDescription desc;
desc.mShape = NxOgre::SimpleCapsule(playerHight, radious);

Critter::BackgroundCharacter* gCharacter = renderSystem->createBackgroundCharacter(NxOgre::Vec3(0,50,0), Ogre::Radian(0), playerRenderNode, desc);

above code compile fine

When I add following
gCharacter->advance or gCharacter->move

compiler gives the following error
Error 13 error C2247: 'NxOgre::CharacterController::move' not accessible because 'Critter::CharacterBase' uses 'protected' to inherit from 'NxOgre::CharacterController' i:\Thegameproject\src\playercharacter.cpp 94

As far as I see these are public members in class NxOgrePublicClass CharacterController.
I need a help to come back to right track.

betajaen

08-01-2011 09:49:27

You don't use the move functions at all in the Critter Background characters, you use the CharacterInput class, or more better the CharacterInputHelper class. They allow you tie your input library directly into NxOgre and without working out how many metres your character should move, or worry about gravity or jumping. It allows digital and analogue inputs too.

For example:

Critter::CharacterInputHelper gCharacterHelper;

if (mKeyboard->isKeyDown(OIS::KC_W)) // Check for forward speed.
gCharacterHelper.forward(127); // Where 127 is the amount of forward speed (between 0-127), 127 is your maximum ground speed (see description), ~63 is half that.

// Give the input to the character, to make him move in your requested direction.
gCharacter->setInput(gCharacterHelper);





It's all explained in this tutorial: https://github.com/betajaen/nxogretutorials/blob/buggyswires/build/NxOgre1201/1201.cpp

mamairaja

08-01-2011 17:29:38

I am very pleased to see the character controller example

Thank you sir

mamairaja

09-01-2011 14:54:38

Thank you sir,

Character Controller works great.
I have tested with terrain(Buggy Swires) also, it works really fine. awesome!

I need one more help hear.

That is rotation of character.

Previously I did this with bloddymess with following. It worked fine.

// player class
OGRE3DBody* playerBody;

void updatePlayer(float timeSinceLastFrame)
{
// to rotate body in Y axis or Yaw operation
playerBody->setAngularVelocity(Vec3(0, playerCamera->getCameraYawAngle(), 0));
}

// player camera class
Real Y_cameraRotation;

Real PlayerCamera::getCameraYawAngle()
{
Ogre::Real yawAngle = Y_cameraRotation

// to clear the angular rotation after applying it, instantly stop
Y_cameraRotation = 0;

return yawAngle;
}

// call from game::mouseMoved event
void PlayerCamera::makecameraMotion(const OIS::MouseEvent &evt)
{
Y_cameraRotation = -evt.state.X.rel;
}


Now I am trying to apply this for CritterBackGroundCharacter. I guess It's need to extending helper class.

If characters y rotation freezed flag is raised i could use slerp operation and setGlobalOrientationQuat for actor.

Could you please advice sir?

Thank you