[Orxonox-commit 5391] r10054 - in code/branches/modularships: data/levels/templates src/orxonox/worldentities/pawns

noep at orxonox.net noep at orxonox.net
Tue May 13 12:38:38 CEST 2014


Author: noep
Date: 2014-05-13 12:38:37 +0200 (Tue, 13 May 2014)
New Revision: 10054

Modified:
   code/branches/modularships/data/levels/templates/ModularSpaceShipTest.oxt
   code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
   code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
Log:
Fixed CollisionShapes of ShipParts reappearing at their spawnposition after destruction.

Modified: code/branches/modularships/data/levels/templates/ModularSpaceShipTest.oxt
===================================================================
--- code/branches/modularships/data/levels/templates/ModularSpaceShipTest.oxt	2014-05-13 09:45:47 UTC (rev 10053)
+++ code/branches/modularships/data/levels/templates/ModularSpaceShipTest.oxt	2014-05-13 10:38:37 UTC (rev 10054)
@@ -56,7 +56,7 @@
             </collisionShapes>
         </StaticEntity>
         
-        <StaticEntity name="two" position="0,0,60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+        <StaticEntity name="two" position="0,0,62" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
             <attached>
                 <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
             </attached>
@@ -65,6 +65,15 @@
             </collisionShapes>
         </StaticEntity>
         
+        <StaticEntity name="two_2" position="0,0,124" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached>
+                <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+            </attached>
+            <collisionShapes>
+                <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+            </collisionShapes>
+        </StaticEntity>
+        
         <StaticEntity name="three" position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
             <attached>
                 <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
@@ -74,7 +83,7 @@
             </collisionShapes>
         </StaticEntity>
         
-        <StaticEntity name="four" position="0,0,-60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+        <StaticEntity name="four" position="0,0,-59" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
             <attached>
                 <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
             </attached>
@@ -82,14 +91,25 @@
                 <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
             </collisionShapes>
         </StaticEntity>
+        
+        <StaticEntity name="four_2" position="0,0,-118" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached>
+                <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+            </attached>
+            <collisionShapes>
+                <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+            </collisionShapes>
+        </StaticEntity>
 
     </attached>
     
     <parts>
-        <ShipPart name="one" initialhealth="15" damageabsorption="1" />
-        <ShipPart name="two" initialhealth="15" damageabsorption="1" />
-        <ShipPart name="three" initialhealth="18" damageabsorption="1" />
+        <ShipPart name="one" initialhealth="20" damageabsorption="1" />
+        <ShipPart name="two" initialhealth="20" damageabsorption="1" />
+        <ShipPart name="two_2" initialhealth="20" damageabsorption="1" />
+        <ShipPart name="three" initialhealth="20" damageabsorption="1" />
         <ShipPart name="four" initialhealth="20" damageabsorption="1" />
+        <ShipPart name="four_2" initialhealth="20" damageabsorption="1" />
     </parts>
     
     <collisionShapes>

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2014-05-13 09:45:47 UTC (rev 10053)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2014-05-13 10:38:37 UTC (rev 10054)
@@ -127,35 +127,10 @@
 
         this->partMap_[entity] = part;
 
-        //This adds a list of SmartPointers for all StaticEntities which have a ShipPart, preventing them from getting deleted. Hopefully.
-        SmartPtr<StaticEntity> newSmartPtr = entity;
-        SmartPtr<StaticEntity>* one = &newSmartPtr;
-        this->entityPtrList_.push_back(one);
-
-        //this->createCSPtrList(this->getWorldEntityCollisionShape());
-
         orxout() << "New entity-part assignment created!" << endl;
     }
 
-    // This should add smartPointers to all (Orxonox)Collisionshapes of this SpaceShip, preventing them fromg etting deleted. Might not work due to weird acting getAttachedShape
-    void ModularSpaceShip::createCSPtrList(CompoundCollisionShape* cs) // FIXME: (noep) remove debug
-    {
-        for (int i=0; i < cs->getNumChildShapes(); i++)
-        {
 
-            if (!orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
-            {
-                SmartPtr<CollisionShape> newSmartPtr = cs->getAttachedShape(i);
-                SmartPtr<CollisionShape>* one = &newSmartPtr;
-                this->csPtrList_.push_back(one);
-            }
-
-            if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
-                createCSPtrList((CompoundCollisionShape*)(cs->getAttachedShape(i)));
-
-        }
-    }
-
     /**
     @brief
         Get the ShipPart an attached entity belongs to.
@@ -304,7 +279,7 @@
             if (itt->second == part)
             {
                 this->detach(itt->first);
-                //itt->first->destroy();
+                itt->first->destroy();
                 //itt->first->setActive(false);
                 //itt->first->setVisible(false);
                 //itt->first->setCollisionResponse(false);

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h	2014-05-13 09:45:47 UTC (rev 10053)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h	2014-05-13 10:38:37 UTC (rev 10054)
@@ -121,8 +121,6 @@
 
             virtual void updatePartAssignment();
 
-            void createCSPtrList(CompoundCollisionShape* cs);
-
         protected:
 
 




More information about the Orxonox-commit mailing list