Changeset 8724 in orxonox.OLD for trunk/src/lib/collision_reaction
- Timestamp:
- Jun 22, 2006, 3:14:58 PM (19 years ago)
- Location:
- trunk/src/lib/collision_reaction
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_reaction/collision_handle.cc
r8495 r8724 101 101 return; 102 102 103 104 //PRINTF(0)("addTarget: %i \n", target);103 // add element 104 PRINTF(5)("addTarget: %i \n", target); 105 105 106 106 this->targetList.push_back(target); … … 177 177 178 178 c->registerCollisionEvent(collisionEvent); 179 PRINTF( 0)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName());179 PRINTF(5)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName()); 180 180 } 181 181 … … 231 231 if( collisionEvent->getEntityA() == this->owner) { 232 232 if( collisionEvent->getEntityB()->isA((ClassID)(*it))) { 233 PRINTF( 0)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),233 PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 234 234 collisionEvent->getEntityB()->getClassName(), *it); 235 235 return true; } … … 237 237 else { 238 238 if( collisionEvent->getEntityA()->isA((ClassID)(*it))) { 239 PRINTF( 0)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),239 PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 240 240 collisionEvent->getEntityA()->getClassName(), *it); 241 241 return true; } -
trunk/src/lib/collision_reaction/cr_object_damage.cc
r8490 r8724 63 63 if( collision->isEntityACollide()) { 64 64 damage = collision->getEntityB()->getDamage(); 65 collision->getEntityA()-> decreaseHealth(damage);65 collision->getEntityA()->hit(damage); 66 66 } 67 67 PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName()); … … 69 69 if( collision->isEntityBCollide()) { 70 70 damage = collision->getEntityA()->getDamage(); 71 collision->getEntityB()-> decreaseHealth(damage);71 collision->getEntityB()->hit(damage); 72 72 } 73 73 PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName()); -
trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8490 r8724 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: Patrick Boenzli … … 24 24 #include "cr_physics_ground_walk.h" 25 25 26 #include "debug.h"27 28 26 #include <vector> 29 27 … … 35 33 */ 36 34 CRPhysicsGroundWalk::CRPhysicsGroundWalk () 37 : CollisionReaction()35 : CollisionReaction() 38 36 { 39 37 this->setClassID(CL_CR_PHYSICS_GROUND_WALK, "CRPhysicsGroundWalk"); … … 45 43 */ 46 44 CRPhysicsGroundWalk::~CRPhysicsGroundWalk () 47 { 48 } 45 {} 49 46 50 47 … … 57 54 CollisionEvent* ce = collision->getCollisionEvents().front(); 58 55 Vector normal = ce->getGroundNormal(); 59 normal.normalize();56 // normal.normalize(); 60 57 61 58 // put it back 62 // PRINTF(0)("putting it back to lastPos: \n");63 // this->lastPositions[0].debug();64 // PRINTF(0)("current pos:\n");65 // collision->getEntityB()->getAbsCoor().debug();59 // PRINTF(0)("putting it back to lastPos: \n"); 60 // this->lastPositions[0].debug(); 61 // PRINTF(0)("current pos:\n"); 62 // collision->getEntityB()->getAbsCoor().debug(); 66 63 64 65 Vector height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor(); 66 67 if(ce->getCollisionPosition().x <= 0.9 && ce->getGroundNormal().len() <= 1.4f) { 68 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor()); 69 return; 70 } 71 if(ce->getGroundNormal().len() <= 0.1f) { 72 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor()); 73 return; 74 } 75 if(ce->getGroundNormal().len() >= 1.4f) { 76 downspeed++; 77 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.08*downspeed,0.0)); 78 return; 79 } 80 81 82 if(height.y < -3.510001 + 10.0) // Above ground 83 { 84 if(height.y > -15.6) // Snap in 85 { 86 downspeed = 0; 87 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,height.y+3.500005 + 10.0,0.0)); 88 } else 89 { 90 downspeed++; 91 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.08*downspeed,0.0)); 92 } 93 94 } 95 else { 96 if(height.y > -3.50000 + 10.0 && height.y < 9.9+ 10.0) // below ground 97 { 98 //if(downspeed <= 0) downspeed =1; 99 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, 0.00001 /*height.y+3.500005 + 10.0*/,0.0)); 100 //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0)); 101 downspeed = 0; 102 } 103 104 } 105 106 107 /* 67 108 PRINTF(0)("Collision with Ground: \n"); 68 109 collision->getEntityB()->getAbsCoor().debug(); 110 collision->getEntityB()->setVelocity(Vector()); 111 collision->getEntityB()->setAbsCoor(this->lastPositions[1]); 69 112 70 //collision->getEntityB()->setVelocity(Vector()); 71 //collision->getEntityB()->setAbsCoor(this->lastPositions[5]); 113 */ 72 114 } 115 73 116 74 117 … … 81 124 for( int i = 9; i > 0; i--) { 82 125 this->lastPositions[i] = this->lastPositions[i-1]; 83 // PRINTF(0)("lastPosition[%i]: %f, %f, %f\n", i, lastPositions[i].x, lastPositions[i].y, lastPositions[i].z);126 // PRINTF(0)("lastPosition[%i]: %f, %f, %f\n", i, lastPositions[i].x, lastPositions[i].y, lastPositions[i].z); 84 127 } 85 128 this->lastPositions[0] = owner->getAbsCoor(); -
trunk/src/lib/collision_reaction/cr_physics_ground_walk.h
r8490 r8724 29 29 30 30 Vector lastPositions[10]; //!< last 10 positions 31 float downspeed; 31 32 }; 32 33
Note: See TracChangeset
for help on using the changeset viewer.