void DefaultGameObjectFactory::SetupBottomWall(GameObject* wall) { Ogre::SceneNode* node = scene_manager_->getSceneNode("bottom_wall"); node->_update(true, true); const Ogre::AxisAlignedBox& wall_rect = node->_getWorldAABB(); Ogre::Vector3 wall_size = wall_rect.getSize(); Size size = { wall_size.x , wall_size.y, wall_size.z }; wall->set_position(center_x_, size.y / 2.f); wall->set_size(size); }
void DefaultGameObjectFactory::SetupBall(GameObject* ball) { Ogre::SceneNode* node = scene_manager_->getSceneNode("ball"); node->_update(true, true); const Ogre::AxisAlignedBox& ball_rect = node->_getWorldAABB(); Ogre::Vector3 ball_size = ball_rect.getSize(); Size size = { ball_size.x, ball_size.y, ball_size.z }; ball->set_position(center_x_, center_y_); ball->set_size(size); ball->set_movement_velocity(50.f); ball->set_rotation_velocity(10.f); Clamp clamp = { { 0.f, 500.f }, { 0.f, 10.f } }; ball->set_clamp(clamp); }
void DefaultGameObjectFactory::SetupPlayer1(GameObject* player) { Ogre::MeshManager& mesh_manager = Ogre::MeshManager::getSingleton(); const Ogre::AxisAlignedBox& wall_rect = static_cast<Ogre::MeshPtr>( mesh_manager.getByName("wall.mesh"))->getBounds(); Ogre::SceneNode* node = scene_manager_->getSceneNode("pad_1"); node->_update(true, true); const Ogre::AxisAlignedBox& pad_rect = node->_getWorldAABB(); mxgame::Real offset = wall_rect.getSize().y + pad_rect.getHalfSize().y; pad_1_lower_limit_ = offset - center_y_; pad_1_upper_limit_ = center_y_ - offset; Ogre::Vector3 pad_size = pad_rect.getSize(); Size size = { pad_size.x, pad_size.y, pad_size.z }; player->set_position(x_border_offset_, center_y_); player->set_size(size); player->set_movement_velocity(250.f); }