Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10054


Ignore:
Timestamp:
May 13, 2014, 12:38:37 PM (11 years ago)
Author:
noep
Message:

Fixed CollisionShapes of ShipParts reappearing at their spawnposition after destruction.

Location:
code/branches/modularships
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/data/levels/templates/ModularSpaceShipTest.oxt

    r10053 r10054  
    5757        </StaticEntity>
    5858       
    59         <StaticEntity name="two" position="0,0,60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     59        <StaticEntity name="two" position="0,0,62" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     60            <attached>
     61                <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
     62            </attached>
     63            <collisionShapes>
     64                <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
     65            </collisionShapes>
     66        </StaticEntity>
     67       
     68        <StaticEntity name="two_2" position="0,0,124" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
    6069            <attached>
    6170                <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
     
    7584        </StaticEntity>
    7685       
    77         <StaticEntity name="four" position="0,0,-60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     86        <StaticEntity name="four" position="0,0,-59" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     87            <attached>
     88                <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
     89            </attached>
     90            <collisionShapes>
     91                <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
     92            </collisionShapes>
     93        </StaticEntity>
     94       
     95        <StaticEntity name="four_2" position="0,0,-118" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
    7896            <attached>
    7997                <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
     
    87105   
    88106    <parts>
    89         <ShipPart name="one" initialhealth="15" damageabsorption="1" />
    90         <ShipPart name="two" initialhealth="15" damageabsorption="1" />
    91         <ShipPart name="three" initialhealth="18" damageabsorption="1" />
     107        <ShipPart name="one" initialhealth="20" damageabsorption="1" />
     108        <ShipPart name="two" initialhealth="20" damageabsorption="1" />
     109        <ShipPart name="two_2" initialhealth="20" damageabsorption="1" />
     110        <ShipPart name="three" initialhealth="20" damageabsorption="1" />
    92111        <ShipPart name="four" initialhealth="20" damageabsorption="1" />
     112        <ShipPart name="four_2" initialhealth="20" damageabsorption="1" />
    93113    </parts>
    94114   
  • code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10053 r10054  
    128128        this->partMap_[entity] = part;
    129129
    130         //This adds a list of SmartPointers for all StaticEntities which have a ShipPart, preventing them from getting deleted. Hopefully.
    131         SmartPtr<StaticEntity> newSmartPtr = entity;
    132         SmartPtr<StaticEntity>* one = &newSmartPtr;
    133         this->entityPtrList_.push_back(one);
    134 
    135         //this->createCSPtrList(this->getWorldEntityCollisionShape());
    136 
    137130        orxout() << "New entity-part assignment created!" << endl;
    138131    }
    139132
    140     // This should add smartPointers to all (Orxonox)Collisionshapes of this SpaceShip, preventing them fromg etting deleted. Might not work due to weird acting getAttachedShape
    141     void ModularSpaceShip::createCSPtrList(CompoundCollisionShape* cs) // FIXME: (noep) remove debug
    142     {
    143         for (int i=0; i < cs->getNumChildShapes(); i++)
    144         {
    145 
    146             if (!orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
    147             {
    148                 SmartPtr<CollisionShape> newSmartPtr = cs->getAttachedShape(i);
    149                 SmartPtr<CollisionShape>* one = &newSmartPtr;
    150                 this->csPtrList_.push_back(one);
    151             }
    152 
    153             if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
    154                 createCSPtrList((CompoundCollisionShape*)(cs->getAttachedShape(i)));
    155 
    156         }
    157     }
    158133
    159134    /**
     
    305280            {
    306281                this->detach(itt->first);
    307                 //itt->first->destroy();
     282                itt->first->destroy();
    308283                //itt->first->setActive(false);
    309284                //itt->first->setVisible(false);
  • code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h

    r10036 r10054  
    122122            virtual void updatePartAssignment();
    123123
    124             void createCSPtrList(CompoundCollisionShape* cs);
    125 
    126124        protected:
    127125
Note: See TracChangeset for help on using the changeset viewer.