I don't know is there a bug in ogre or i'm doing something wrong.
I'm trying to create FPS game. I created scene node and atached weapon and camera to it. Camera is set to the same position as SceneNode and weapon moved to the right. But when i rotate scene node camera is not acting as it should. for example: when i move mouse to the right camera is not moved to the right but to the right AND down.
When i move only camera without attaching it to the SceneNode everything is right.
Is there difference in rotation of SceneNode and Camera...
Rotation problem
- SuprChikn
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
- Contact:
- haffax
- OGRE Retired Moderator

- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 8
- Contact:
razi3l, just before you attach the camera to the scenenode, do the following:
Else you have the old values, that were there before as an offset and the camera does not behave as expected. If you use the example framework, the camera is indeed moved without a scenenode in the scene setup.
Code: Select all
camera->setPosition(Vector3::ZERO);
camera->setOrientation(Quaternion::IDENTITY);
- razi3l
- Gnoblar
- Posts: 8
- Joined: Fri Mar 18, 2005 11:42 pm
I've just try that and it doesn't work.
.
.
.
I've also tried with TS_LOCAL and TS_PARENT.
Code: Select all
m_pControlNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode();
m_pControlNode->setPosition( 0, 0, 0 );
m_pCamera->setPosition( Vector3::ZERO );
m_pCamera->setOrientation( Quaternion::IDENTITY );
m_pControlNode->attachObject( m_pCamera );
m_pWeaponNode = m_pControlNode->createChildSceneNode();
m_pWeaponNode->attachObject( m_pWeapon );
m_pWeaponNode->setPosition( 2, -1.5, -5 );
m_pWeaponNode->yaw( (Radian)Math::PI );
.
.
Code: Select all
m_pControlNode->setPosition( m_Player.vPosition );
m_pControlNode->lookAt( vLookAt, Node::TransformSpace::TS_WORLD );
- SuprChikn
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
- Contact:
- razi3l
- Gnoblar
- Posts: 8
- Joined: Fri Mar 18, 2005 11:42 pm
Sory i didn't answered before.
Yes vLookAt is pointing in right direction. I tried it with camera, without
attaching it to the SceneNode and it works ok.
I also tried setting camera and scenenode, (not attached) at the same position and same rotation. They both rotate BUT they don't acting the same way. Camera is always little "faster" than scenenode.
Yes vLookAt is pointing in right direction. I tried it with camera, without
attaching it to the SceneNode and it works ok.
I also tried setting camera and scenenode, (not attached) at the same position and same rotation. They both rotate BUT they don't acting the same way. Camera is always little "faster" than scenenode.
-
Sinjaph
- Kobold
- Posts: 29
- Joined: Tue Apr 12, 2005 11:41 pm
- BlasterN
- Gnome
- Posts: 378
- Joined: Thu Mar 24, 2005 1:07 am
- Location: Spain
- Contact:
you have to offset your model for the weapon ( i don't know how much ). with that you can rotate camera & the model at the same time and work perfectly.
With the code in the post left by Sinjaph you can do it.
BTW. try OgreOde have a little example, the ragdoll one, that is a little fps. http://www.green-eyed-monster.com/
With the code in the post left by Sinjaph you can do it.
BTW. try OgreOde have a little example, the ragdoll one, that is a little fps. http://www.green-eyed-monster.com/
Works:
MapToMesh | Bengine B9 @ www.sourceforge.net/projects/maptoogremesh/
3DWorldStudio exporter@ www.blastern.info
MapToMesh | Bengine B9 @ www.sourceforge.net/projects/maptoogremesh/
3DWorldStudio exporter@ www.blastern.info