heading in degrees. I'm trying to get the camera situated height-wise,
and make sure it always pointed straight ahead as I manually move my
character position across the terrain based on heading (it's legacy code).
I noticed after I call (in the setup)
Code: Select all
m_pCamera =m_pSmgr->addCameraSceneNodeFPS(m_pParent,100.0f,1.2f);
m_pCamera->setPosition(core::vector3df(2700*2,255*2,2600*2));
m_pCamera->setTarget(core::vector3df(2397*2,343*2,2700*2));
m_pCamera->setFarValue(42000.0f);
Code: Select all
m_pCamera->setPosition(core::vector3df(2700*2,255*8,2600*2));
this is because the camera lookat hasn't changed. So how do I keep that
straight ahead?
How do I position the scene based on a heading in degrees?
I'm currently using (in the render loop)
Code: Select all
//handle movement
core::vector3df nodePosition = m_pCamera->getPosition();
//based on the heading set X and Z
float fHeadingRadians = ((m_pMe->m_iHeading/m_pMe->ANGLE_1) * PI)/180;
nodePosition.X -= (m_pMe->m_iSpeed*cos(fHeadingRadians));
nodePosition.Z += (m_pMe->m_iSpeed*sin(fHeadingRadians));
m_pCamera->setPosition(nodePosition);
thanks![/code]