[Orxonox-commit 1347] r6065 - in code/branches/particles2: data/levels data/levels/includes data/particle src/modules/weapons/projectiles src/modules/weapons/weaponmodes src/orxonox/controllers src/orxonox/worldentities
scheusso at orxonox.net
scheusso at orxonox.net
Sun Nov 15 13:15:42 CET 2009
Author: scheusso
Date: 2009-11-15 13:15:42 +0100 (Sun, 15 Nov 2009)
New Revision: 6065
Added:
code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc
code/branches/particles2/src/modules/weapons/projectiles/Rocket.h
code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.cc
code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.h
Removed:
code/branches/particles2/data/particle/Ogre.log
code/branches/particles2/src/orxonox/controllers/RocketController.cc
code/branches/particles2/src/orxonox/controllers/RocketController.h
code/branches/particles2/src/orxonox/worldentities/Rocket.cc
code/branches/particles2/src/orxonox/worldentities/Rocket.h
Modified:
code/branches/particles2/data/levels/empty_level.oxw
code/branches/particles2/data/levels/includes/weaponsettings3.oxi
code/branches/particles2/src/modules/weapons/projectiles/CMakeLists.txt
code/branches/particles2/src/modules/weapons/weaponmodes/CMakeLists.txt
code/branches/particles2/src/orxonox/controllers/CMakeLists.txt
code/branches/particles2/src/orxonox/worldentities/CMakeLists.txt
Log:
cleaned up Rocket mess a bit
there is yet a bug if RocketFire is in weaponslot3
Modified: code/branches/particles2/data/levels/empty_level.oxw
===================================================================
--- code/branches/particles2/data/levels/empty_level.oxw 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/data/levels/empty_level.oxw 2009-11-15 12:15:42 UTC (rev 6065)
@@ -17,7 +17,7 @@
skybox = "Orxonox/Starbox"
>
-<Rocket position="-10, 3.5,800" velocity="0,0,-100">
+<!--Rocket position="-10, 3.5,800" velocity="0,0,-100">
<attached>
<Model pitch=180 position="0,0,0" scale=1.5 mesh="rocket_test.mesh" >
<attached>
@@ -28,7 +28,7 @@
</attached>
</Model>
</attached>
- </Rocket>
+ </Rocket-->
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
Modified: code/branches/particles2/data/levels/includes/weaponsettings3.oxi
===================================================================
--- code/branches/particles2/data/levels/includes/weaponsettings3.oxi 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/data/levels/includes/weaponsettings3.oxi 2009-11-15 12:15:42 UTC (rev 6065)
@@ -1,17 +1,19 @@
<weaponslots>
<WeaponSlot position="-15.0,-1.5,0" />
<WeaponSlot position=" 15.0,-1.5,0" />
- <WeaponSlot position=" 0.0, 0.0,0" />
+ <WeaponSlot position=" 0, 0,0" />
</weaponslots>
<weaponsets>
<WeaponSet firemode=0 />
<WeaponSet firemode=1 />
+ <WeaponSet firemode=2 />
</weaponsets>
<weapons>
<WeaponPack>
<links>
<DefaultWeaponmodeLink firemode=0 weaponmode=0 />
<DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+ <DefaultWeaponmodeLink firemode=2 weaponmode=2 />
</links>
<Weapon>
<attached>
@@ -35,6 +37,9 @@
<HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.7, 1.5, -4.0" />
<LightningGun mode=1 muzzleoffset="0,0,0" />
</Weapon>
+ <Weapon>
+ <RocketFire mode=2 muzzleoffset="0,0,0" />
+ </Weapon>
</WeaponPack>
<WeaponPack>
<links>
Deleted: code/branches/particles2/data/particle/Ogre.log
===================================================================
--- code/branches/particles2/data/particle/Ogre.log 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/data/particle/Ogre.log 2009-11-15 12:15:42 UTC (rev 6065)
@@ -1,58 +0,0 @@
-13:25:05: Creating resource group General
-13:25:05: Creating resource group Internal
-13:25:05: Creating resource group Autodetect
-13:25:05: Registering ResourceManager for type Material
-13:25:05: Registering ResourceManager for type Mesh
-13:25:05: Registering ResourceManager for type Skeleton
-13:25:05: MovableObjectFactory for type 'ParticleSystem' registered.
-13:25:05: Loading library OgrePlatform.dll
-13:25:05: OverlayElementFactory for type Panel registered.
-13:25:05: OverlayElementFactory for type BorderPanel registered.
-13:25:05: OverlayElementFactory for type TextArea registered.
-13:25:05: Registering ResourceManager for type Font
-13:25:05: ArchiveFactory for archive type FileSystem registered.
-13:25:05: ArchiveFactory for archive type Zip registered.
-13:25:05: DevIL version: Developer's Image Library (DevIL) 1.6.7 Oct 28 2005
-13:25:05: DevIL image formats: bmp dib cut dcx dds gif hdr ico cur jpg jpe jpeg lif mdl mng jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda icb vst tif tiff wal xpm raw
-13:25:05: Registering ResourceManager for type HighLevelGpuProgram
-13:25:05: Registering ResourceManager for type Compositor
-13:25:05: MovableObjectFactory for type 'Entity' registered.
-13:25:05: MovableObjectFactory for type 'Light' registered.
-13:25:05: MovableObjectFactory for type 'BillboardSet' registered.
-13:25:05: MovableObjectFactory for type 'ManualObject' registered.
-13:25:05: MovableObjectFactory for type 'BillboardChain' registered.
-13:25:05: MovableObjectFactory for type 'RibbonTrail' registered.
-13:25:05: An exception has been thrown!
-
------------------------------------
-Details:
------------------------------------
-Error #: 8
-Function: ConfigFile::load
-Description: 'plugins.cfg' file not found!.
-File: \cvs\ogrenew\OgreMain\src\OgreConfigFile.cpp
-Line: 79
-Stack unwinding: <<beginning of stack>>
-13:25:05: plugins.cfg not found, automatic plugin loading disabled.
-13:25:05: *-*-* OGRE Initialising
-13:25:05: *-*-* Version 1.3.0 (Eihort)
-13:25:05: An exception has been thrown!
-
------------------------------------
-Details:
------------------------------------
-Error #: 8
-Function: ConfigFile::load
-Description: 'resources.cfg' file not found!.
-File: \cvs\ogrenew\OgreMain\src\OgreConfigFile.cpp
-Line: 79
-Stack unwinding: <<beginning of stack>>
-13:25:10: ___Particle Editor closing down cleanly.___
-13:25:10: *-*-* OGRE Shutdown
-13:25:10: Unregistering ResourceManager for type Compositor
-13:25:10: Unregistering ResourceManager for type Font
-13:25:10: Unregistering ResourceManager for type Skeleton
-13:25:10: Unregistering ResourceManager for type Mesh
-13:25:10: Unregistering ResourceManager for type HighLevelGpuProgram
-13:25:10: Unregistering ResourceManager for type Material
-13:25:10: Unloading library OgrePlatform.dll
Modified: code/branches/particles2/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/branches/particles2/src/modules/weapons/projectiles/CMakeLists.txt 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/modules/weapons/projectiles/CMakeLists.txt 2009-11-15 12:15:42 UTC (rev 6065)
@@ -3,4 +3,5 @@
ParticleProjectile.cc
Projectile.cc
LightningGunProjectile.cc
+ Rocket.cc
)
Copied: code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc (from rev 6059, code/branches/particles2/src/orxonox/worldentities/Rocket.cc)
===================================================================
--- code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc (rev 0)
+++ code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc 2009-11-15 12:15:42 UTC (rev 6065)
@@ -0,0 +1,193 @@
+/*
+ * 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:
+ * Reto Grieder
+ * Co-authors:
+ * Martin Stypinski
+ *
+ */
+
+#include "Rocket.h"
+
+#include "core/XMLPort.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+#include "worldentities/pawns/Pawn.h"
+#include "graphics/ParticleSpawner.h"
+#include "graphics/Model.h"
+#include "objects/collisionshapes/ConeCollisionShape.h"
+
+namespace orxonox
+{
+ CreateFactory(Rocket); // put your code in here:
+ // create the factory for the Rocket
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ */
+ Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
+ {
+ RegisterObject(Rocket);// - register the Rocket class to the core
+
+ this->setCollisionType(WorldEntity::Kinematic);
+ this->setVelocity(0,0,-100);
+ this->model_ = new Model(this);
+ this->model_->setMeshSource("can.mesh");
+ this->attach(this->model_);
+ this->lifetime_ = 100;
+
+ if (GameMode::isMaster())
+ {
+ this->enableCollisionCallback();
+ this->setCollisionResponse(false);
+ this->setCollisionType(Kinematic);
+
+ this->collisionShape_ = new ConeCollisionShape(this);
+ this->collisionShape_->setRadius(3);
+ this->collisionShape_->setHeight(500);
+ this->attachCollisionShape(this->collisionShape_);
+
+ this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this)));
+ }
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ Rocket::~Rocket()
+ {
+ if(this->isInitialized())
+ {
+ this->collisionShape_->destroy();
+ this->model_->destroy();
+ }
+ }
+
+ /**
+ @brief
+ Method for creating a Rocket through XML.
+ */
+ void Rocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ // this calls the XMLPort function of the parent class
+ SUPER(Rocket, XMLPort, xmlelement, mode);
+ }
+
+ void Rocket::setOwner(Pawn* owner)
+ {
+ this->owner_ = owner;
+ }
+
+ /**
+ @brief
+ Defines which actions the Rocket has to take in each tick.
+ @param dt
+ The length of the tick.
+ */
+ void Rocket::tick(float dt)
+ {
+ SUPER(Rocket, tick, dt);
+
+ this->setAngularVelocity(this->localAngularVelocity_);
+ }
+
+ bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ {
+ if (!this->bDestroy_ && GameMode::isMaster())
+ {
+ if (otherObject == this->owner_)
+ return false;
+
+ this->bDestroy_ = true;
+
+ if (this->owner_)
+ {
+ {
+ ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+ effect->setPosition(this->getPosition());
+ effect->setOrientation(this->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/explosion3");
+ effect->setLifetime(2.0f);
+ }
+ {
+ ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+ effect->setPosition(this->getPosition());
+ effect->setOrientation(this->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/smoke4");
+ effect->setLifetime(3.0f);
+ }
+ }
+
+ float dmg = this->damage_;
+ if (this->owner_)
+ dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
+
+ Pawn* victim = orxonox_cast<Pawn*>(otherObject);
+ if (victim)
+ victim->damage(dmg, this->owner_);
+ }
+ return false;
+ }
+
+ void Rocket::destroyObject()
+ {
+ if (GameMode::isMaster())
+ this->destroy();
+ }
+
+ /**
+ @brief
+ Rotates the Rocket around the y-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void Rocket::rotateYaw(const Vector2& value)
+ {
+ this->localAngularVelocity_.y = value.x;
+ }
+
+ /**
+ @brief
+ Rotates the Rocket around the x-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void Rocket::rotatePitch(const Vector2& value)
+ {
+ this->localAngularVelocity_.x = value.x;
+ }
+
+ /**
+ @brief
+ Rotates the Rocket around the z-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void Rocket::rotateRoll(const Vector2& value)
+ {
+ this->localAngularVelocity_.z = value.x;
+ }
+
+}
Copied: code/branches/particles2/src/modules/weapons/projectiles/Rocket.h (from rev 6059, code/branches/particles2/src/orxonox/worldentities/Rocket.h)
===================================================================
--- code/branches/particles2/src/modules/weapons/projectiles/Rocket.h (rev 0)
+++ code/branches/particles2/src/modules/weapons/projectiles/Rocket.h 2009-11-15 12:15:42 UTC (rev 6065)
@@ -0,0 +1,127 @@
+/*
+ * 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:
+ * Reto Grieder
+ * Co-authors:
+ * Martin Stypinski
+ *
+ */
+
+#ifndef _Rocket_H__
+#define _Rocket_H__
+
+#include "OrxonoxPrereqs.h"
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+ class ConeCollisionShape;
+
+ /**
+ @brief
+ Rocket, that is made to move upon a specified pattern.
+ This class was constructed for the PPS tutorial.
+ @author
+ Oli Scheuss
+ */
+ class _OrxonoxExport Rocket : public ControllableEntity
+ {
+ public:
+ Rocket(BaseObject* creator);
+ virtual ~Rocket();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.
+ virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
+
+ virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ void destroyObject();
+
+ virtual void moveFrontBack(const Vector2& value){}
+ virtual void moveRightLeft(const Vector2& value){}
+ virtual void moveUpDown(const Vector2& value){}
+
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotatePitch(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+
+ /**
+ @brief Moves the Rocket in the Front/Back-direction by the specifed amount.
+ @param value The amount by which the Rocket is to be moved.
+ */
+ inline void moveFrontBack(float value)
+ { this->moveFrontBack(Vector2(value, 0)); }
+ /**
+ @brief Moves the Rocket in the Right/Left-direction by the specifed amount.
+ @param value The amount by which the Rocket is to be moved.
+ */
+ inline void moveRightLeft(float value)
+ { this->moveRightLeft(Vector2(value, 0)); }
+ /**
+ @brief Moves the Rocket in the Up/Down-direction by the specifed amount.
+ @param value The amount by which the Rocket is to be moved.
+ */
+ inline void moveUpDown(float value)
+ { this->moveUpDown(Vector2(value, 0)); }
+
+ /**
+ @brief Rotates the Rocket around the y-axis by the specifed amount.
+ @param value The amount by which the Rocket is to be rotated.
+ */
+ inline void rotateYaw(float value)
+ { this->rotateYaw(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Rocket around the x-axis by the specifed amount.
+ @param value The amount by which the Rocket is to be rotated.
+ */
+ inline void rotatePitch(float value)
+ { this->rotatePitch(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Rocket around the z-axis by the specifed amount.
+ @param value The amount by which the Rocket is to be rotated.
+ */
+ inline void rotateRoll(float value)
+ { this->rotateRoll(Vector2(value, 0)); }
+
+ void setOwner(Pawn* owner);
+ inline Pawn* getOwner() const
+ { return this->owner_; }
+
+ inline void setDamage(float damage)
+ { this->damage_ = damage; }
+ inline float getDamage() const
+ { return this->damage_; }
+
+ private:
+ WeakPtr<Pawn> owner_;
+ Vector3 localAngularVelocity_;
+ float damage_;
+ bool bDestroy_;
+
+ Model* model_;
+ ConeCollisionShape* collisionShape_;
+ Timer destroyTimer_;
+ float lifetime_;
+ };
+
+}
+
+#endif /* _Rocket_H__ */
Modified: code/branches/particles2/src/modules/weapons/weaponmodes/CMakeLists.txt
===================================================================
--- code/branches/particles2/src/modules/weapons/weaponmodes/CMakeLists.txt 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/modules/weapons/weaponmodes/CMakeLists.txt 2009-11-15 12:15:42 UTC (rev 6065)
@@ -4,4 +4,5 @@
LaserFire.cc
HsW01.cc
LightningGun.cc
+ RocketFire.cc
)
Copied: code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.cc (from rev 6059, code/branches/particles2/src/modules/weapons/weaponmodes/FusionFire.cc)
===================================================================
--- code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.cc (rev 0)
+++ code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.cc 2009-11-15 12:15:42 UTC (rev 6065)
@@ -0,0 +1,67 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "RocketFire.h"
+
+#include "util/Math.h"
+#include "core/CoreIncludes.h"
+#include "weapons/projectiles/Rocket.h"
+
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(RocketFire);
+
+ RocketFire::RocketFire(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(RocketFire);
+
+ this->reloadTime_ = 0.20;
+ this->bParallelReload_ = false;
+ this->damage_ = 100;
+ this->speed_ = 500;
+
+ this->setMunitionName("RocketMunition");
+ }
+
+ void RocketFire::fire()
+ {
+ Rocket* rocket = new Rocket(this);
+
+ rocket->setOrientation(this->getMuzzleOrientation());
+ rocket->setPosition(this->getMuzzlePosition());
+ rocket->setVelocity(this->getMuzzleDirection() * this->speed_);
+ rocket->scale(2);
+
+ rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ rocket->setDamage(this->getDamage());
+ }
+}
Copied: code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.h (from rev 6059, code/branches/particles2/src/modules/weapons/weaponmodes/FusionFire.h)
===================================================================
--- code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.h (rev 0)
+++ code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.h 2009-11-15 12:15:42 UTC (rev 6065)
@@ -0,0 +1,50 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _RocketFire_H__
+#define _RocketFire_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+ class _WeaponsExport RocketFire : public WeaponMode
+ {
+ public:
+ RocketFire(BaseObject* creator);
+ virtual ~RocketFire() {}
+
+ virtual void fire();
+
+ private:
+ float speed_;
+ };
+}
+
+#endif /* _RocketFire_H__ */
Modified: code/branches/particles2/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/branches/particles2/src/orxonox/controllers/CMakeLists.txt 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/orxonox/controllers/CMakeLists.txt 2009-11-15 12:15:42 UTC (rev 6065)
@@ -6,5 +6,4 @@
ScriptController.cc
WaypointController.cc
WaypointPatrolController.cc
- RocketController.cc
)
Deleted: code/branches/particles2/src/orxonox/controllers/RocketController.cc
===================================================================
--- code/branches/particles2/src/orxonox/controllers/RocketController.cc 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/orxonox/controllers/RocketController.cc 2009-11-15 12:15:42 UTC (rev 6065)
@@ -1,78 +0,0 @@
-/*
- * 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:
- * Oli Scheuss
- * Co-authors:
- * ...
- *
- */
-
-#include "RocketController.h"
-#include "worldentities/Rocket.h"
-#include "util/Math.h"
-
-
-namespace orxonox
-{
- CreateFactory(RocketController);
- /**
- @brief
- Constructor.
- */
- RocketController::RocketController(BaseObject* creator) : Controller(creator)
- {
- // Place your code here:
- RegisterObject(RocketController);
- // - make sure to register the object in the factory
- // - do any kind of initialisation
-
- // this checks that our creator really is a Rocket
- // and saves the pointer to the Rocket for the controlling commands
- assert(dynamic_cast<Rocket*>(creator)!=0);
- this->setControllableEntity(dynamic_cast<Rocket*>(creator));
- Rocket *myRocket = static_cast<Rocket*>(this->getControllableEntity());
- //myRocket->setVelocity(Vector3(0,0,-60));
- }
-
- RocketController::~RocketController()
- {
- }
-
- /**
- @brief
- The controlling happens here. This method defines what the controller has to do each tick.
- @param dt
- The duration of the tick.
- */
- void RocketController::tick(float dt)
- {
- // Place your code here:
- // - steering commands
- //Rocket *myRocket = static_cast<Rocket*>(this->getControllableEntity());
-
- // you can use the following commands for steering
- // - moveFrontBack, moveRightLeft, moveUpDown
- // - rotatePitch, rotateYaw, rotateRoll
- // - apply the to myRocket (e.g. myRocket->rotateYaw(..) )
-
- }
-}
Deleted: code/branches/particles2/src/orxonox/controllers/RocketController.h
===================================================================
--- code/branches/particles2/src/orxonox/controllers/RocketController.h 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/orxonox/controllers/RocketController.h 2009-11-15 12:15:42 UTC (rev 6065)
@@ -1,59 +0,0 @@
-/*
- * 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:
- * Oli Scheuss
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _RocketController_H__
-#define _RocketController_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "Controller.h"
-#include "tools/interfaces/Tickable.h"
-
-namespace orxonox
-{
- /**
- @brief
- Controller for the Rocket of the PPS tutorial.
- @author
- Oli Scheuss
- */
- class _OrxonoxExport RocketController : public Controller, public Tickable
- {
- public:
- RocketController(BaseObject* creator);
- virtual ~RocketController();
-
- virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
-
- protected:
-
- private:
- };
-}
-
-#endif /* _RocketController_H__ */
Modified: code/branches/particles2/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/particles2/src/orxonox/worldentities/CMakeLists.txt 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/orxonox/worldentities/CMakeLists.txt 2009-11-15 12:15:42 UTC (rev 6065)
@@ -4,7 +4,6 @@
MovableEntity.cc
MobileEntity.cc
ControllableEntity.cc
- Rocket.cc
BigExplosion.cc
ExplosionChunk.cc
Deleted: code/branches/particles2/src/orxonox/worldentities/Rocket.cc
===================================================================
--- code/branches/particles2/src/orxonox/worldentities/Rocket.cc 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/orxonox/worldentities/Rocket.cc 2009-11-15 12:15:42 UTC (rev 6065)
@@ -1,183 +0,0 @@
-/*
- * 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:
- * Reto Grieder
- * Co-authors:
- * Martin Stypinski
- *
- */
-
-#include "Rocket.h"
-
-#include "core/XMLPort.h"
-#include "BulletDynamics/Dynamics/btRigidBody.h"
-
-namespace orxonox
-{
- CreateFactory(Rocket); // put your code in here:
- // create the factory for the Rocket
-
- /**
- @brief
- Constructor. Registers the object and initializes some default values.
- */
- Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
- {
- this->myController_ = 0;
- // put your code in here:
- RegisterObject(Rocket);// - register the Rocket class to the core
-
- this->localLinearAcceleration_.setValue(0, 0, 0);
- this->localAngularAcceleration_.setValue(0, 0, 0);
- this->primaryThrust_ = 100;
- this->auxilaryThrust_ = 100;
- this->rotationThrust_ = 10;
-
- this->setCollisionType(WorldEntity::Kinematic);
-
- this->myController_ = new RocketController(static_cast<BaseObject*>(this)); //!< Creates a new controller and passes our this pointer to it as creator.
- }
-
- /**
- @brief
- Destructor. Destroys controller, if present.
- */
- Rocket::~Rocket()
- {
- if( this->myController_ != NULL )
- this->myController_->destroy();
- }
-
- /**
- @brief
- Method for creating a Rocket through XML.
- */
- void Rocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- // this calls the XMLPort function of the parent class
- SUPER(Rocket, XMLPort, xmlelement, mode);
-
- // put your code in here:
- XMLPortParam(Rocket, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
- //XMLPortParam(Rocket, "auxilaryThrust", setAuxilaryThrust, getAuxilaryThrust, xmlelement, mode);
- //XMLPortParam(Rocket, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
- // make sure you add the variables primaryThrust_, auxilaryThrust_ and rotationThrust_ to xmlport
- // make sure that the set- and get-functions exist.
- // variables can be added by the following command
- // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunction, getFunction, xmlelement, mode)
-
- }
-
- /**
- @brief
- Defines which actions the Rocket has to take in each tick.
- @param dt
- The length of the tick.
- */
- void Rocket::tick(float dt)
- {
- SUPER(Rocket, tick, dt);
-
- //if (this->hasLocalController())
- //{
- this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
- this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
- if (this->localLinearAcceleration_.z() > 0)
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
- else
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
- this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
- this->localLinearAcceleration_.setValue(0, 0, 0);
-
- this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
- this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
- this->localAngularAcceleration_.setValue(0, 0, 0);
- //}
- }
-
- /**
- @brief
- Moves the Rocket in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the movement.
- */
- void Rocket::moveFrontBack(const Vector2& value)
- {
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
- }
-
- /**
- @brief
- Moves the Rocket in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the movement.
- */
- void Rocket::moveRightLeft(const Vector2& value)
- {
- this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
- }
-
- /**
- @brief
- Moves the Rocket in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the movement.
- */
- void Rocket::moveUpDown(const Vector2& value)
- {
- this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
- }
-
- /**
- @brief
- Rotates the Rocket around the y-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void Rocket::rotateYaw(const Vector2& value)
- {
- this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
- }
-
- /**
- @brief
- Rotates the Rocket around the x-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void Rocket::rotatePitch(const Vector2& value)
- {
- this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
- }
-
- /**
- @brief
- Rotates the Rocket around the z-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void Rocket::rotateRoll(const Vector2& value)
- {
- this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
- }
-
-}
Deleted: code/branches/particles2/src/orxonox/worldentities/Rocket.h
===================================================================
--- code/branches/particles2/src/orxonox/worldentities/Rocket.h 2009-11-14 23:28:34 UTC (rev 6064)
+++ code/branches/particles2/src/orxonox/worldentities/Rocket.h 2009-11-15 12:15:42 UTC (rev 6065)
@@ -1,131 +0,0 @@
-/*
- * 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:
- * Reto Grieder
- * Co-authors:
- * Martin Stypinski
- *
- */
-
-#ifndef _Rocket_H__
-#define _Rocket_H__
-
-#include "OrxonoxPrereqs.h"
-#include "worldentities/ControllableEntity.h"
-#include "controllers/RocketController.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Rocket, that is made to move upon a specified pattern.
- This class was constructed for the PPS tutorial.
- @author
- Oli Scheuss
- */
- class _OrxonoxExport Rocket : public ControllableEntity
- {
- public:
- Rocket(BaseObject* creator);
- virtual ~Rocket();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.
- virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
-
-
- virtual void moveFrontBack(const Vector2& value);
- virtual void moveRightLeft(const Vector2& value);
- virtual void moveUpDown(const Vector2& value);
-
- virtual void rotateYaw(const Vector2& value);
- virtual void rotatePitch(const Vector2& value);
- virtual void rotateRoll(const Vector2& value);
-
- /**
- @brief Moves the Rocket in the Front/Back-direction by the specifed amount.
- @param value The amount by which the Rocket is to be moved.
- */
- inline void moveFrontBack(float value)
- { this->moveFrontBack(Vector2(value, 0)); }
- /**
- @brief Moves the Rocket in the Right/Left-direction by the specifed amount.
- @param value The amount by which the Rocket is to be moved.
- */
- inline void moveRightLeft(float value)
- { this->moveRightLeft(Vector2(value, 0)); }
- /**
- @brief Moves the Rocket in the Up/Down-direction by the specifed amount.
- @param value The amount by which the Rocket is to be moved.
- */
- inline void moveUpDown(float value)
- { this->moveUpDown(Vector2(value, 0)); }
-
- /**
- @brief Rotates the Rocket around the y-axis by the specifed amount.
- @param value The amount by which the Rocket is to be rotated.
- */
- inline void rotateYaw(float value)
- { this->rotateYaw(Vector2(value, 0)); }
- /**
- @brief Rotates the Rocket around the x-axis by the specifed amount.
- @param value The amount by which the Rocket is to be rotated.
- */
- inline void rotatePitch(float value)
- { this->rotatePitch(Vector2(value, 0)); }
- /**
- @brief Rotates the Rocket around the z-axis by the specifed amount.
- @param value The amount by which the Rocket is to be rotated.
- */
- inline void rotateRoll(float value)
- { this->rotateRoll(Vector2(value, 0)); }
-
- /**
- @brief Sets the primary thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setPrimaryThrust( float thrust )
- { this->primaryThrust_=thrust; }
- // place your set-functions here.
- // - hint: auxiliary thrust, rotation thrust.
-
- /**
- @brief Gets the primary thrust to the input amount.
- @preturn The amount of thrust.
- */
- inline float getPrimaryThrust()
- { return this->primaryThrust_; }
- // place your get-functions here.
-
- private:
- RocketController *myController_; //!< The controller of the Rocket.
-
- btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the Rocket the next tick.
- btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the Rocket the next tick.
- float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward.
- float auxilaryThrust_; //!< The amount of auxilary thrust. Used for all other movements (except for rotations).
- float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.
- };
-
-}
-
-#endif /* _Rocket_H__ */
More information about the Orxonox-commit
mailing list