My First Attempt Failed, and I'm wondering if I'm missing something:
Code: Select all
bool Camera::HandleEvent(Event e)
{
if (e.m_Recipient == m_Name || e.m_Recipient == "All")
{
if (e.m_Event == "Cam_Move")
m_CameraNode->translate(Ogre::StringConverter::parseVector3(e.m_Data), Ogre::SceneNode::TS_LOCAL);
if (e.m_Event == "Cam_Pitch")
{
float move = Ogre::StringConverter::parseReal(e.m_Data) * -0.13;
m_MouseY += move;
if (m_MouseY <= m_BoxSize.y && m_MouseY >= 0)
{
//Mouse just moved inside the box, just update the look at
m_CurrentChild->GetNode()->lookAt(Ogre::Vector3(m_MouseX, m_MouseY, -100), Ogre::SceneNode::TS_LOCAL);
}
else if (m_MouseY <= 0 || m_MouseY >= m_BoxSize.y)
{
//Thinking outside the box, reset the mouse so the cursor doesn't go outside the box
m_MouseY -= move;
// yaw it
m_CameraNode->pitch(Ogre::Degree(move), Ogre::SceneNode::TS_LOCAL);
}
}
if (e.m_Event == "Cam_Yaw")
{
float move = Ogre::StringConverter::parseReal(e.m_Data) * -0.13;
m_MouseX += move;
if (m_MouseX <= m_BoxSize.x && m_MouseX >= 0)
{
//Mouse just moved inside the box, just update the look at
m_CurrentChild->GetNode()->lookAt(Ogre::Vector3(m_MouseX, m_MouseY, -100), Ogre::SceneNode::TS_LOCAL);
}
else if (m_MouseX <= 0 || m_MouseX >= m_BoxSize.x)
{
//Thinking outside the box
m_MouseX -= move;
// yaw it
m_CameraNode->yaw(Ogre::Degree(move), Ogre::SceneNode::TS_WORLD);
}
}
}
return true;
}
The weapon basically moves around like somone who just drank a liter of espresso at once. It also blinks very fast when i just start :\
I'll see if i can make a little movie of the behavior sometime tonight.
I just want to see if there was anything that i missed in my first attempt thats obvious
-- The Robomaniac
