Changeset 9997
- Timestamp:
- Mar 12, 2014, 6:39:46 PM (11 years ago)
- Location:
- code/branches/modularships
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/modularships/data/levels/emptyLevel.oxw
r9996 r9997 49 49 </MovableEntity> 50 50 51 <Pawn health= 30 position="0,-100,0" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Box 4" >51 <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,0" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Box 4" > 52 52 <attached> 53 53 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> 54 <Model position="0,-30,0" mesh="cube.mesh" scale3D="15,15,15" /> 55 <StaticEntity position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 > 56 <attached> 57 <Model position="0,0,0" mesh="cube.mesh" scale3D="15,15,15" /> 58 <Model position="0,0,30" mesh="cube.mesh" scale3D="15,15,15" /> 59 </attached> 60 <collisionShapes> 61 <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> 62 <BoxCollisionShape position="0,0,30" halfExtents="15,15,15" /> 63 </collisionShapes> 64 </StaticEntity> 54 65 </attached> 55 66 <collisionShapes> 56 67 <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> 57 <BoxCollisionShape position="0,- 15,0" halfExtents="15,15,15" />68 <BoxCollisionShape position="0,-30,0" halfExtents="15,15,15" /> 58 69 </collisionShapes> 59 70 </Pawn> -
code/branches/modularships/src/orxonox/collisionshapes/CollisionShape.h
r9667 r9997 170 170 void notifyDetached(); // Notifies the CollisionShape of being detached from a CompoundCollisionShape. 171 171 172 inline unsigned int getparentID() 173 { return this->parentID_; } 174 172 175 protected: 173 176 virtual void updateParent(); // Updates the CompoundCollisionShape the CollisionShape belongs to, after the CollisionShape has changed. -
code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r9667 r9997 297 297 this->updatePublicShape();*/ 298 298 } 299 300 int CompoundCollisionShape::getNumChildShapes() 301 { 302 return this->compoundShape_->getNumChildShapes(); 303 } 299 304 } -
code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.h
r9667 r9997 71 71 72 72 virtual void changedScale(); 73 int getNumChildShapes(); 73 74 74 75 private: -
code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
r9995 r9997 408 408 */ 409 409 virtual bool isCollisionTypeLegal(CollisionType type) const = 0; 410 411 inline virtual WorldEntityCollisionShape* getWorldEntityCollisionShape() 412 { return this->collisionShape_; } 410 413 411 414 btRigidBody* physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance. -
code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
r9996 r9997 50 50 #include "controllers/FormationController.h" 51 51 52 #include "collisionshapes/WorldEntityCollisionShape.h" 53 52 54 namespace orxonox 53 55 { … … 276 278 void Pawn::customDamage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 277 279 { 280 int collisionShapeIndex = this->isMyCollisionShape(cs); 281 orxout() << collisionShapeIndex << endl; 282 278 283 // Applies multiplier given by the DamageBoost Pickup. 279 284 if (originator) … … 611 616 } 612 617 613 618 // WIP function that (once I get it working) determines to which attached entity a collisionshape belongs. 619 // Shame that this doesn't seem to work as intended. It behaves differently (different number of childshapes) every reload. D: 620 int Pawn::isMyCollisionShape(const btCollisionShape* cs) 621 { 622 // This entities WECS 623 WorldEntityCollisionShape* ownWECS = this->getWorldEntityCollisionShape(); 624 625 // e.g. "Box 4: Searching for CS 0x1ad49200" 626 orxout() << this->getRadarName() << ": Searching for CS " << cs << endl; 627 // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060" 628 orxout() << " " << this->getRadarName() << " is WorldEntityCollisionShape " << ownWECS << endl; 629 // e.g. "Box 4 is objectID 943" 630 orxout() << " " << this->getRadarName() << " is objectID " << this->getObjectID() << endl; 631 632 // print child shapes of this WECS 633 printChildShapes(ownWECS, 2, 0); 634 635 // end 636 orxout() << " " << this->getRadarName() << ": no matching CS found." << endl; 637 return -1; 638 } 639 640 void Pawn::printChildShapes(CompoundCollisionShape* cs, int indent, int subshape) 641 { 642 // e.g. " Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:" 643 printSpaces(indent); orxout() << "Childshape " << subshape << " (WECS " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl; 644 645 for (int i=0; i < cs->getNumChildShapes(); i++) 646 { 647 // For each childshape, print: 648 // pointer to the btCollisionShape 649 printSpaces(indent+2); orxout() << "Bt-Childshape " << i << ": " << cs->getAttachedShape(i)->getCollisionShape() << endl; 650 651 // pointer to the CollisionShape 652 printSpaces(indent+2); orxout() << "Orx-Childshape " << i << ": " << cs->getAttachedShape(i) << endl; 653 654 // parentID of the CollisionShape 655 printSpaces(indent+2); orxout() << "ParentID of CS " << i << ": " << cs->getAttachedShape(i)->getparentID() << endl; 656 657 // if the childshape is a CompoundCollisionShape, print its children. 658 if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i))) 659 { 660 printChildShapes((CompoundCollisionShape*)(cs->getAttachedShape(i)), indent+2, i); 661 } 662 } 663 } 664 665 void Pawn::printSpaces(int number) 666 { 667 for(int i=0; i<number; i++) 668 orxout() << " "; 669 } 614 670 } -
code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
r9995 r9997 232 232 unsigned int numexplosionchunks_; 233 233 234 virtual int isMyCollisionShape(const btCollisionShape* cs); 235 void printChildShapes(CompoundCollisionShape* cs, int indent, int subshape); 236 void printSpaces(int num); 237 234 238 private: 235 239 void registerVariables();
Note: See TracChangeset
for help on using the changeset viewer.