- Timestamp:
- Mar 27, 2014, 3:49:50 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
r10003 r10007 53 53 #include <BulletCollision/CollisionShapes/btCollisionShape.h> 54 54 #include <BulletCollision/CollisionShapes/btCompoundShape.h> 55 #include "graphics/Model.h" 55 56 56 57 … … 638 639 orxout() << " " << this->getRadarName() << " has the following Objects attached:" << endl; 639 640 for (int i=0; i<10; i++) 640 orxout() << " " << i << ": " << this->getAttachedObject(i) << endl; 641 { 642 if (this->getAttachedObject(i)==NULL) 643 break; 644 orxout() << " " << i << ": " << this->getAttachedObject(i); 645 if(!orxonox_cast<Model*>(this->getAttachedObject(i))) 646 orxout() << " (SE)"; 647 orxout() << endl; 648 } 649 650 if (this->health_ < 800) 651 this->detach(this->getAttachedObject(2)); 641 652 642 653 // print child shapes of this WECS 643 // printChildShapes(ownWECS, 2, 0);644 654 printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0); 645 655 656 int temp = entityOfCollisionShape(cs); 657 if (temp==0) 658 orxout() << this->getRadarName() << " has been hit on it's main body." << endl; 659 else 660 orxout() << this->getRadarName() << " has been hit on the attached entity no. " << temp << endl; 646 661 647 662 // end 648 orxout() << " " << this->getRadarName() << ": no matching CS found." << endl;649 663 return -1; 650 }651 652 void Pawn::printChildShapes(CompoundCollisionShape* cs, int indent, int subshape)653 {654 for (int i=0; i < cs->getNumChildShapes(); i++)655 {656 orxout() << "" << endl;657 }658 /*659 // e.g. " Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:"660 printSpaces(indent); orxout() << "Childshape " << subshape << " (CS* " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl;661 662 // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"663 printSpaces(indent); orxout() << "Childshape " << subshape << " is btCollisionShape* " << cs->getCollisionShape() << endl;664 665 for (int i=0; i < cs->getNumChildShapes(); i++)666 {667 printSpaces(indent+2); orxout() << "- " << i << " - - -" << endl;668 printSpaces(indent+2); orxout() << "This Shape is a ";669 if (orxonox_cast<WorldEntityCollisionShape*>(cs->getAttachedShape(i)))670 orxout() << "WECS ";671 if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))672 orxout() << "CCS ";673 if (orxonox_cast<CollisionShape*>(cs->getAttachedShape(i)))674 orxout() << "CS ";675 orxout() << endl;676 677 // For each childshape, print:678 679 // parentID of the CollisionShape680 printSpaces(indent+2); orxout() << "ParentID: " << cs->getAttachedShape(i)->getObjectID() << endl;681 682 // parentID of the CollisionShape683 printSpaces(indent+2); orxout() << "ParentID: " << cs->getAttachedShape(i)->getParentID() << endl;684 685 // parent of the CollisionShape686 printSpaces(indent+2); orxout() << "ParentCCS*: " << cs->getAttachedShape(i)->getParent() << endl;687 688 // pointer to the btCollisionShape689 printSpaces(indent+2); orxout() << "btCollisionShape*: " << cs->getAttachedShape(i)->getCollisionShape() << endl;690 691 // pointer to the CollisionShape692 printSpaces(indent+2); orxout() << "CollisionShape*: " << cs->getAttachedShape(i) << endl;693 694 if (cs->getAttachedShape(i)->getCollisionShape() != NULL)695 {696 // pointer to the user of the btCollisionShape697 printSpaces(indent+2); orxout() << "bt: getUserPointer: " << cs->getAttachedShape(i)->getCollisionShape()->getUserPointer() << endl;698 699 //700 printSpaces(indent+2); orxout() << "bt: isCompound: " << cs->getAttachedShape(i)->getCollisionShape()->isCompound() << endl;701 }702 703 // if the childshape is a CompoundCollisionShape, print its children.704 if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))705 {706 printChildShapes((CompoundCollisionShape*)(cs->getAttachedShape(i)), indent+2, i);707 }708 709 }*/710 664 } 711 665 … … 736 690 } 737 691 692 int Pawn::entityOfCollisionShape(const btCollisionShape* cs) 693 { 694 btCompoundShape* ownBtCS = (btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()); 695 696 return -1; 697 } 698 738 699 void Pawn::printSpaces(int num) 739 700 { -
code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
r10003 r10007 233 233 234 234 virtual int isMyCollisionShape(const btCollisionShape* cs); 235 void printChildShapes(CompoundCollisionShape* cs, int indent, int subshape);236 235 void printBtChildShapes(btCompoundShape* cs, int indent, int subshape); 237 236 void printSpaces(int num); 237 int entityOfCollisionShape(const btCollisionShape* cs); 238 238 239 239 private:
Note: See TracChangeset
for help on using the changeset viewer.