/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Fabien Vultier * Co-authors: * ... * */ /** @file SOBQBlock.cc @brief If this QBlock is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure starts flying fast until the fuel is reduced to zero. */ #include "SOBQBlock.h" #include "core/CoreIncludes.h" namespace orxonox { RegisterClass(SOBQBlock); SOBQBlock::SOBQBlock(Context* context) : SOBItem(context) { RegisterObject(SOBQBlock); used_ = false; // setPosition(Vector3(0,0,0)); // setVelocity(Vector3(0,0,0)); // setAcceleration(Vector3(0,0,0)); // setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); } SOBQBlock::~SOBQBlock() { } bool SOBQBlock::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { float v_z = otherObject->getVelocity().z; if (!used_ && v_z > 50.0) { used_ = true; orxout() << "WDestrozed the block" << v_z << endl; for (WorldEntity* object : this->getAttachedObjects()) { object->setVisible(!object->isVisible()); } } return true; } }