- Timestamp:
- Mar 12, 2014, 6:39:46 PM (11 years ago)
- Location:
- code/branches/modularships/src/orxonox/worldentities/pawns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.