[Orxonox-commit 3880] r8554 - in code/branches/pickup: data/levels data/levels/includes data/levels/templates src/libraries/util src/modules/objects/collisionshapes src/modules/pickup src/modules/pickup/items src/orxonox/collisionshapes src/orxonox/worldentities
dafrick at orxonox.net
dafrick at orxonox.net
Mon May 23 23:26:08 CEST 2011
Author: dafrick
Date: 2011-05-23 23:26:08 +0200 (Mon, 23 May 2011)
New Revision: 8554
Modified:
code/branches/pickup/data/levels/includes/pickups.oxi
code/branches/pickup/data/levels/pickups.oxw
code/branches/pickup/data/levels/templates/pickupRepresentationTemplates.oxt
code/branches/pickup/src/libraries/util/SubString.h
code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h
code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h
code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h
code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h
code/branches/pickup/src/modules/pickup/PickupPrereqs.h
code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc
code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h
code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc
code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h
code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc
Log:
Some cleanup. Ready for merge.
Modified: code/branches/pickup/data/levels/includes/pickups.oxi
===================================================================
--- code/branches/pickup/data/levels/includes/pickups.oxi 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/data/levels/includes/pickups.oxi 2011-05-23 21:26:08 UTC (rev 8554)
@@ -201,7 +201,7 @@
<PickupRepresentation
pickupName = "Drone Pickup"
- pickupDescription = "Adds a Drone to the Players Spaceship"
+ pickupDescription = "Adds a Drone to the Player's Spaceship"
spawnerTemplate = "dronepickupRepresentation"
>
<pickup>
@@ -212,8 +212,8 @@
<!-- Shrink Pickup -->
<PickupRepresentation
- pickupName = "Shrink Pickup"
- pickupDescription = "Adds a Drone to the Players Spaceship"
+ pickupName = "Small Shrink"
+ pickupDescription = "Shrinks the Ship by a bit"
spawnerTemplate = "smallshrinkpickupRepresentation"
>
<pickup>
@@ -221,3 +221,23 @@
</pickup>
</PickupRepresentation>
+<PickupRepresentation
+ pickupName = "Medium Shrink"
+ pickupDescription = "Shrinks the Ship"
+ spawnerTemplate = "mediumshrinkpickupRepresentation"
+>
+ <pickup>
+ <ShrinkPickup template=mediumshrinkpickup />
+ </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+ pickupName = "Huge Shrink"
+ pickupDescription = "Shrinks the Ship considerably"
+ spawnerTemplate = "hugeshrinkpickupRepresentation"
+>
+ <pickup>
+ <ShrinkPickup template=hugeshrinkpickup />
+ </pickup>
+</PickupRepresentation>
+
Modified: code/branches/pickup/data/levels/pickups.oxw
===================================================================
--- code/branches/pickup/data/levels/pickups.oxw 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/data/levels/pickups.oxw 2011-05-23 21:26:08 UTC (rev 8554)
@@ -189,11 +189,32 @@
</pickup>
</PickupSpawner>
- <PickupSpawner position="-30,-30,-30" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
+ <PickupSpawner position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
<pickup>
<ShrinkPickup template ="smallshrinkpickup"/>
</pickup>
</PickupSpawner>
+ <PickupSpawner position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
+ <pickup>
+ <ShrinkPickup template ="mediumshrinkpickup"/>
+ </pickup>
+ </PickupSpawner>
+
+ <PickupSpawner position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
+ <pickup>
+ <ShrinkPickup template ="hugeshrinkpickup"/>
+ </pickup>
+ </PickupSpawner>
+
+ <!--StaticEntity position="0,-200,0" direction="0,-1,0" collisionType=static mass=500 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10,10,10" />
+ </collisionShapes>
+ </StaticEntity-->
+
</Scene>
</Level>
Modified: code/branches/pickup/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/pickup/data/levels/templates/pickupRepresentationTemplates.oxt 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/data/levels/templates/pickupRepresentationTemplates.oxt 2011-05-23 21:26:08 UTC (rev 8554)
@@ -402,7 +402,7 @@
<attached>
<Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.9 />
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.4 />
</attached>
</Billboard>
</attached>
@@ -413,7 +413,8 @@
<Template name=smallshrinkpickup>
<InvisiblePickup
- duration = 20.0
+ duration = 10.0
+ shrinkFactor = 2.5
activaionType = "immediate"
durationType = "continuous"
/>
@@ -424,9 +425,9 @@
<spawner-representation>
<StaticEntity>
<attached>
- <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.2>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=2.0 />
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.7 />
</attached>
</Billboard>
</attached>
@@ -437,7 +438,8 @@
<Template name=mediumshrinkpickup>
<InvisiblePickup
- duration = 20.0
+ duration = 30.0
+ shrinkFactor = 5.0
activaionType = "immediate"
durationType = "continuous"
/>
@@ -448,9 +450,9 @@
<spawner-representation>
<StaticEntity>
<attached>
- <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.3>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=3.0 />
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=1.0 />
</attached>
</Billboard>
</attached>
@@ -461,7 +463,8 @@
<Template name=hugeshrinkpickup>
<InvisiblePickup
- duration = 20.0
+ duration = 60.0
+ shrinkFactor = 10.0
activaionType = "immediate"
durationType = "continuous"
/>
Modified: code/branches/pickup/src/libraries/util/SubString.h
===================================================================
--- code/branches/pickup/src/libraries/util/SubString.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/libraries/util/SubString.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -168,7 +168,7 @@
inline bool empty() const { return this->tokens_.empty(); }
/// Returns the number of tokens stored in this SubString
inline unsigned int size() const { return this->tokens_.size(); }
- /// Returns the i'th token from the subset of strings @param index The index of the requested doken
+ /// Returns the i'th token from the subset of strings @param index The index of the requested token
inline const std::string& operator[](unsigned int index) const { return this->tokens_[index]; }
/// Returns the i'th token from the subset of strings @param index The index of the requested token
inline const std::string& getString(unsigned int index) const { return (*this)[index]; }
Modified: code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -50,6 +50,7 @@
@author
Reto Grieder
+ @see btBoxShape
@ingroup Collisionshapes
*/
class _ObjectsExport BoxCollisionShape : public CollisionShape
Modified: code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -48,7 +48,8 @@
@author
Reto Grieder
- @ingroup Collisionshapes.
+ @see btConeShape
+ @ingroup Collisionshapes
*/
class _ObjectsExport ConeCollisionShape : public CollisionShape
{
Modified: code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -50,6 +50,7 @@
@author
Martin Stypinski
+ @see btStaticPlaneShape
@ingroup Collisionshapes
*/
class _ObjectsExport PlaneCollisionShape : public CollisionShape
Modified: code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -48,6 +48,7 @@
@author
Reto Grieder
+ @see btSphereShape
@ingroup Collisionshapes
*/
class _ObjectsExport SphereCollisionShape : public CollisionShape
Modified: code/branches/pickup/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/branches/pickup/src/modules/pickup/PickupPrereqs.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/pickup/PickupPrereqs.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -81,7 +81,7 @@
class MetaPickup;
class SpeedPickup;
class ShieldPickup;
- class ShrinkPickup;
+ class ShrinkPickup;
}
Modified: code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc
===================================================================
--- code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc 2011-05-23 21:26:08 UTC (rev 8554)
@@ -50,7 +50,7 @@
{
CreateFactory(ShrinkPickup);
- /**
+ /**
@brief
Constructor: Initializes the Pickup.
*/
@@ -59,6 +59,9 @@
RegisterObject(ShrinkPickup);
this->initialize();
+ this->shrinkFactor_ = 5.0;
+ this->shrinkSpeed_ = 5.0;
+ this->duration_ = 5.0;
isActive_ = false;
isTerminating_ = false;
}
@@ -91,7 +94,7 @@
/**
@brief
- Method for creating a HealthPickup object through XML.
+ Method for creating a ShrinkhPickup object through XML.
*/
void ShrinkPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
{
@@ -142,7 +145,7 @@
this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
}
- /**
+ /**
@brief
Prepares for shrinking (collecting several informations).
*/
@@ -152,13 +155,13 @@
if(this->isUsed())
{
- this->pawn = this->carrierToPawnHelper();
- if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
+ this->pawn_ = this->carrierToPawnHelper();
+ if(pawn_ == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
this->Pickupable::destroy();
//Collect scaling information.
- defaultScale_ = this->pawn->getScale3D();
- defaultMass_ = this->pawn->getMass();
+ defaultScale_ = this->pawn_->getScale3D();
+ defaultMass_ = this->pawn_->getMass();
smallScale_ = defaultScale_ / shrinkFactor_;
smallMass_ = defaultMass_ / shrinkFactor_;
@@ -166,14 +169,14 @@
actualScale_ = defaultScale_;
actualMass_ = defaultMass_;
- cameraPositions_ = this->pawn->getCameraPositions();
+ cameraPositions_ = this->pawn_->getCameraPositions();
size_ = cameraPositions_.size();
isActive_ = true; //start shrinking now.
- durationTimer.setTimer(duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this))); //Set timer for termination.
+ durationTimer_.setTimer(duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this))); //Set timer for termination.
}
}
- /**
+ /**
@brief
Updates the scales of the ship.
@param dt
@@ -188,12 +191,12 @@
actualScale_ /= factor_;
actualMass_ /= factor_;
- this->pawn->setScale3D(actualScale_);
- this->pawn->setMass(actualMass_);
+ this->pawn_->setScale3D(actualScale_);
+ this->pawn_->setMass(actualMass_);
for(int index = 0; index < size_; index++)
{
- CameraPosition* cameraPos_ = this->pawn->getCameraPosition(index);
+ CameraPosition* cameraPos_ = this->pawn_->getCameraPosition(index);
if(cameraPos_ == NULL)
continue;
cameraPos_->setPosition(cameraPos_->getPosition()*factor_);
@@ -208,12 +211,12 @@
actualScale_ *= factor_;
actualMass_ *= factor_;
- this->pawn->setScale3D(actualScale_);
- this->pawn->setMass(actualMass_);
+ this->pawn_->setScale3D(actualScale_);
+ this->pawn_->setMass(actualMass_);
for(int index = 0; index < size_; index++)
{
- CameraPosition* cameraPos_ = this->pawn->getCameraPosition(index);
+ CameraPosition* cameraPos_ = this->pawn_->getCameraPosition(index);
if(cameraPos_ == NULL)
continue;
cameraPos_->setPosition(cameraPos_->getPosition()/factor_);
@@ -224,7 +227,7 @@
}
- /**
+ /**
@brief
Initializes the termination.
*/
@@ -243,7 +246,7 @@
return pawn;
}
- /**
+ /**
@brief
Creates a duplicate of the input OrxonoxClass.
@param item
Modified: code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h
===================================================================
--- code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -47,7 +47,7 @@
namespace orxonox {
/**
- @author
+ @author
Sandro Sgier
@ingroup PickupItems
@@ -100,7 +100,7 @@
private:
void initialize(void);
- float duration_; //!< determines how long the pickup will be active
+ float duration_; //!< determines how long the pickup will be active
float shrinkFactor_; //shrink factor of the space ship
float shrinkSpeed_; //speed of shrinking
bool isActive_; //true if ship is shrinking or small
@@ -113,10 +113,10 @@
Ogre::Vector3 smallScale_;
float defaultMass_;
float actualMass_;
- float smallMass_;
+ float smallMass_;
Pawn* carrierToPawnHelper(void);
- Pawn* pawn;
- Timer durationTimer;
+ Pawn* pawn_;
+ Timer durationTimer_;
void terminate(void);
};
}
Modified: code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2011-05-23 21:26:08 UTC (rev 8554)
@@ -260,7 +260,33 @@
{
CollisionShape::changedScale();
- // Iterate through all attached CollisionShapes.
+ std::vector<CollisionShape*> shapes;
+ // Iterate through all attached CollisionShapes and add them to the list of shapes.
+ for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
+ shapes.push_back(it->first);
+
+ // Delete the compound shape and create a new one.
+ delete this->compoundShape_;
+ this->compoundShape_ = new btCompoundShape();
+
+ // Re-attach all CollisionShapes.
+ for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
+ {
+ CollisionShape* shape = *it;
+ shape->setScale3D(this->getScale3D());
+ // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
+ if (shape->getCollisionShape())
+ {
+ btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
+ // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape.
+ this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
+ }
+ }
+
+ this->updatePublicShape();
+
+ /*
+ // Iterate through all attached CollisionShapes
for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
{
// Rescale the CollisionShape.
@@ -268,6 +294,6 @@
this->updateAttachedShape(it->first);
}
- this->updatePublicShape();
+ this->updatePublicShape();*/
}
}
Modified: code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h 2011-05-23 21:26:08 UTC (rev 8554)
@@ -51,6 +51,7 @@
@author
Reto Grieder
+ @see btCompoundShape
@ingroup Collisionshapes
*/
class _OrxonoxExport CompoundCollisionShape : public CollisionShape
Modified: code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc 2011-05-23 16:41:25 UTC (rev 8553)
+++ code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc 2011-05-23 21:26:08 UTC (rev 8554)
@@ -642,10 +642,10 @@
void WorldEntity::setScale3D(const Vector3& scale)
{
// If physics is enabled scale the attached CollisionShape.
- if (false && this->hasPhysics() && this->collisionShape_ != NULL)
+ /*if (this->hasPhysics() && this->collisionShape_ != NULL)
{
this->collisionShape_->setScale3D(scale);
- }
+ }*/
this->node_->setScale(scale);
More information about the Orxonox-commit
mailing list