void WorldManager::putBallAtTopWallEdge() { Wall *topWall = mWorld->getTopWall(); Ball *ball = mWorld->getBall(); Ogre::Vector3 topWallPosition = topWall->getPosition(); Ogre::Vector3 topWallDimension = topWall->getDimension(); Ogre::Vector3 ballPosition = ball->getPosition(); Ogre::Vector3 ballDimension = ball->getDimension(); ballPosition.y = topWallPosition.y - (topWallDimension.y + ballDimension.y)/2; ball->setPosition(ballPosition); }
void WorldManager::putBallAtBottomWallEdge() { Wall *bottomWall = mWorld->getBottomWall(); Ball *ball = mWorld->getBall(); Ogre::Vector3 bottomWallPosition = bottomWall->getPosition(); Ogre::Vector3 bottomWallDimension = bottomWall->getDimension(); Ogre::Vector3 ballPosition = ball->getPosition(); Ogre::Vector3 ballDimension = ball->getDimension(); ballPosition.y = bottomWallPosition.y + (bottomWallDimension.y + ballDimension.y)/2; ball->setPosition(ballPosition); }