コード例 #1
0
ファイル: WorldManager.cpp プロジェクト: schen59/Pong
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);
}
コード例 #2
0
ファイル: WorldManager.cpp プロジェクト: schen59/Pong
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);
}