rotating a character mesh.

jchmack

28-08-2007 21:44:06

ok i have a character:


// Create character
NxOgre::CharacterParams Params;
Params.setToDefault();
Params.mType = NxOgre::CharacterParams::CT_Box;
Params.mSkinWidth = 0.5;
mCharacter = mScene->createCharacter(Name, InitialPosition, Params);

// Create mesh
//mCharacter->attachMesh("cube.1m.mesh");
//mCharacter->getNode()->scale(0.25f,2.0f,0.25f);
mCharacter->attachMesh(Mesh);
mCharacter->createNode();
MeshNode = mCharacter->getNode();
MeshEntity = mCharacter->getEntity();


and i can scale him:


MeshNode->scale( Vector3(1,1,1)*MercMeshConverter*(CharacterHeight+2*(CharacterRadius)));


but for some reason i cant move or rotate him:


MeshNode->translate(Vector3(0,(CharacterHeight/2),0));
MeshNode->yaw(Degree(180));


why would scale work and not rotate or translate?

betajaen

28-08-2007 21:47:12

Because of in the next render, it'll set the orientation of the node right back. If your character is naturally facing the wrong way, you'll have to add a node in the character nodes, with an offset orientation.

jchmack

28-08-2007 21:53:19

Because of in the next render, it'll set the orientation of the node right back. If your character is naturally facing the wrong way, you'll have to add a node in the character nodes, with an offset orientation.

lol i figured it out as you were posting:

here is my code for anyone who needs something similar:


mCharacter->createNode();
MeshNode = mCharacter->getNode()->createChildSceneNode();
MeshEntity = mScene->getSceneManager()->createEntity(mCharacter->getName(), Mesh);
MeshNode->attachObject(MeshEntity);

AdjustMesh();