tdynamicnode = this->_obj_mgr_scene->getRootSceneNode()->createChildSceneNode("DynamicNode");
tdynamicnode->attachObject(_obj_camera_one);
Entity* tempdynentity = nullptr;
tempdynentity = this->_obj_mgr_scene->createEntity("Sphere",tspheremesh);
tdynamicnode->attachObject(tempdynentity);
if (tnotexiting)
{
this->_obj_mgr_camera_one->frameRenderingQueued(pframe_event);
this->_node_player_disp = Vector3::ZERO;
if(this->_actn_move_fwd)
{
this->_node_player_disp += Vector3::NEGATIVE_UNIT_Z * 100 * pframe_event.timeSinceLastFrame;
}
if(this->_actn_move_bkwrd)
{
this->_node_player_disp += Vector3::UNIT_Z * 100 * pframe_event.timeSinceLastFrame;
}
if(this->_actn_strafe_left)
{
this->_node_player_disp += Vector3::NEGATIVE_UNIT_X * 100 * pframe_event.timeSinceLastFrame;
}
if(this->_actn_strafe_right)
{
this->_node_player_disp += Vector3::UNIT_X * 100 * pframe_event.timeSinceLastFrame;
}
this->tdynamicnode->translate(this->_node_player_disp);
}
bool tresult = true;
if(pkeyevt.key == OIS::KC_W)
{
this->_actn_move_fwd = true;
}
else if(pkeyevt.key == OIS::KC_S)
{
this->_actn_move_bkwrd = true;
}
else if(pkeyevt.key == OIS::KC_A)
{
this->_actn_strafe_left = true;
}
else if(pkeyevt.key == OIS::KC_D)
{
this->_actn_strafe_right = true;
}
Node::ChildNodeIterator itr = this->_node_obstacles->getChildIterator();
bool tcollide = false;
while (itr.hasMoreElements())
{
SceneNode* n = (Ogre::SceneNode *)itr.getNext();
if(n->_getWorldAABB().intersects(_node_player->_getWorldAABB()))
{
tcollide = true;
}
}
if(tcollide)
{
this->_node_player->translate(-5 * this->_node_player_disp);
}
I need help with getting the collision to work properly. its so frustrating when its almost there but you cant figure out what it is. Ogre's website doesn't have much.