createCharacter() ignores orientation

Arcanor

19-02-2008 14:28:00

I've noticed that the implementation of NxOgre::Character ignores the orientation part of the pose that's sent into the constructor.

This works fine for createBody(), but not for createCharacter().

Is there anything I can do to re-orient my characters' "frontward facing" without changing the model itself?

jchmack

19-02-2008 17:57:20

Ya i noticed this too. You cant just do it like this:


mCharacter = mScene->createCharacter(Name, NxOgre::Pose(InitialPosition,InitialOrientation) , Params);


What i did was set direction right after i create it:

mCharacter->setDirection(InitialOrientation);


But for some reason this isn't set till the next frame. So you kinda see a small jump.

No real use in complaining about the 0.9 character code though because betajaen is changing it all in bleeding. I recommend using my method with the small frame jump and just waiting for bleeding to have characters =).

Arcanor

19-02-2008 19:53:50

Thanks for the reply jchmack. Your code works perfectly well if I actually want to change the whole node's orientation, but what I'm trying to do is change the model's orientation with respect to the node itself.

For example, let's say I have a model that faces to the left by default. I want to make it so that the character controller walks forward properly. So if the node is facing in the MINUS_Z direction (properly), my model appears to be facing in the MINUS_X direction (incorrectly). I need to rotate my model around the Y axis by 90 degrees without changing the node, so that both the node and model are facing in the MINUS_Z direction.

Night Elf

19-02-2008 20:25:16

Just put your model on a node that's a child of the Character's node. You can rotate the child node as you wish without altering the character.

Arcanor

19-02-2008 23:24:15

Thanks for the idea Night Elf. Your suggestion does mostly work. I still need to adjust my camera as it's based on the character entity's orientation, but the physics is working properly. Here's my code if anyone's interested:
ArcObject* ArcWorldMgr::CreateCharacter(Ogre::String entName, Ogre::String meshName, Ogre::Vector3 position, Ogre::Quaternion orientation)
{
ArcObject* obj = new ArcObject();
mvObjects.push_back(obj);

NxOgre::Character* character = mScene->createCharacter(entName, NxOgre::Pose(position, orientation), "type: capsule");
character->attachMesh(meshName);
character->createNode();
obj->setCharacter(character);
obj->setEntity(character->getEntity());
Ogre::SceneNode* newNode = character->getNode()->createChildSceneNode(Ogre::Vector3::ZERO, orientation);
character->getNode()->detachObject(character->getEntity());
newNode->attachObject(character->getEntity());

return obj;
}