mnm23
08-08-2006 20:24:38
Hows it going guys. Im back with yet another problem. I am unable to turn my character node. I can turn the camera around the character. I can turn the sceneNode that attaches to the character but i am unable to turn the character. This is what i have so far.
This next line attaches the camera to the character.
This line was supposed to turn the character. You can see that it tries to turn him, because the camera is slightly moving from side to side, but it as if its being forced to just keep looking straight ahead, where the characters orientation is facing.
So i then decided to create a sceneNode to move instead of actual characterNode. Now this did turn the sceneNode and the camera follwed it whever it went but the characterNode still stayed facing the same direction. Ninja did not turn.
When i take the ninjaNode out and replace it with myNinja(myNinja is character node) and i try to turn, the character will not turn but when try to move the ninja it moves in the direction i rotated the mouse but character is still facing the original orientation.
I have some images so you can get a better idea of what i am talking about, but unfortunately i am unable to upload it to my site right now. I will do so later. Thanks again for all the help guys.
Oh and one other thing i have looked through the forum here and did find aother post with almost the same problem i have, so i tried the method betajaen suggested with creating a mouseNode and not attaching it to anything. This didnt work either. Thanks again.
myNinja = mScene->createCharacter("ninja1", "ninja.mesh", Vector3(10, 2, -5), Vector3(0.3, 1.8, 0.3));
This next line attaches the camera to the character.
levelCam = new CameraState(mSceneMgr, myNinja);
This line was supposed to turn the character. You can see that it tries to turn him, because the camera is slightly moving from side to side, but it as if its being forced to just keep looking straight ahead, where the characters orientation is facing.
if ( mLMouseDown )
{
myNinja->mNode->yaw( Degree( -mInputDevice->getMouseRelativeX() * 0.13) );
myNinja->mNode->pitch(Degree( -mInputDevice->getMouseRelativeY() * 0.13) );
//myNinja->turn(myNinja->mNode->getOrientation());
//myNamespace::writeF("Left Buttom.log", "Left mouse button pressed");
} // if
So i then decided to create a sceneNode to move instead of actual characterNode. Now this did turn the sceneNode and the camera follwed it whever it went but the characterNode still stayed facing the same direction. Ninja did not turn.
ninjaNode = myNinja->mNode->createChildSceneNode("NinjaNode");
//Camera attaches to sceneNode now
levelCam = new CameraState(mSceneMgr, ninjaNode);
//in frameListener
if ( mLMouseDown )
{
mRotX = Degree( -mInputDevice->getMouseRelativeX() * 0.13);
mRotY = Degree( -mInputDevice->getMouseRelativeY() * 0.13);
ninjaNode->yaw(mRotX);
//ninjaNode->pitch(mRotY);
myNinja->turn(ninjaNode->getOrientation());
}
When i take the ninjaNode out and replace it with myNinja(myNinja is character node) and i try to turn, the character will not turn but when try to move the ninja it moves in the direction i rotated the mouse but character is still facing the original orientation.
I have some images so you can get a better idea of what i am talking about, but unfortunately i am unable to upload it to my site right now. I will do so later. Thanks again for all the help guys.
Oh and one other thing i have looked through the forum here and did find aother post with almost the same problem i have, so i tried the method betajaen suggested with creating a mouseNode and not attaching it to anything. This didnt work either. Thanks again.