- Timestamp:
- Sep 25, 2005, 7:04:28 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/physics/physics_connection.h
r5039 r5257 1 1 /*! 2 2 * @file physics_connection.h 3 * Definition of The Physical Connection Class. 3 * Definition of The Physical Connection Class. 4 * @todo 4 5 */ 5 6 -
trunk/src/lib/physics/physics_interface.cc
r5255 r5257 99 99 } 100 100 101 void PhysicsInterface::applyForce(const Vector& force) 102 { 103 PNode* tmp = dynamic_cast<PNode*>((BaseObject*)this); 104 this->forceSum += force; 105 this->bForceApplied = true; 106 } 107 101 108 /** 102 109 * ticks the PhysicsEffect … … 107 114 // Vector acc = this->forceSum / ( this->massChildren + this->mass ); 108 115 PNode* coorTick = dynamic_cast<PNode*>((BaseObject*)this); 109 if (this->bForceApplied && coorTick) 116 if (coorTick != NULL ) 117 coorTick->shiftCoor((coorTick->getVelocity()+ this->forceSum/this->mass*dt)*dt); 118 119 if (this->bForceApplied) 110 120 { 111 coorTick->shiftCoor((coorTick->getVelocity()+ this->forceSum/this->mass * dt)*dt);112 113 121 this->bForceApplied = false; 122 this->forceSum = Vector(0,0,0); 114 123 } 115 this->forceSum = Vector(0,0,0);116 124 } -
trunk/src/lib/physics/physics_interface.h
r5143 r5257 39 39 inline float getTotalMass( void ) const { return mass + massChildren; }; 40 40 41 virtual void applyForce(const Vector& force); 41 42 virtual void applyField(Field* field); 42 43 virtual void tickPhys( float dt ); -
trunk/src/world_entities/npc.cc
r5087 r5257 43 43 if (entity->isA(CL_PROJECTILE)) 44 44 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 45 this->setVisibiliy(false); 46 State::getWorldEntityList()->remove(this); 45 this->applyForce(Vector(0,0,0)-location*1000); 46 // this->setVisibiliy(false); 47 // State::getWorldEntityList()->remove(this); 47 48 } 48 49 … … 50 51 void NPC::tick(float dt) 51 52 { 52 Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());53 // Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor()); 53 54 54 55 //if (directin.len() < 100) 55 this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));56 // this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0)); 56 57 this->shiftDir(Quaternion(dt, this->randomRotAxis)); 57 58 -
trunk/src/world_entities/npc.h
r5059 r5257 4 4 5 5 #include "world_entity.h" 6 #include "physics_interface.h" 6 7 7 8 class AI; 8 9 9 class NPC : public WorldEntity {10 class NPC : public WorldEntity, public PhysicsInterface { 10 11 11 12 public: -
trunk/src/world_entities/player.h
r5212 r5257 23 23 the player.cc for debug also 24 24 */ 25 class Player : public WorldEntity, public PhysicsInterface, publicEventListener25 class Player : public WorldEntity, public EventListener 26 26 { 27 27 friend class World; -
trunk/src/world_entities/weapons/test_bullet.cc
r5063 r5257 59 59 } 60 60 61 61 void TestBullet::collidesWith(WorldEntity* entity, const Vector& location) 62 { 63 this->destroy(); 64 } 62 65 63 66 /** … … 79 82 // this->finalize(); 80 83 GarbageCollector::getInstance()->collect(this); 81 this->lifeCycle = 0.0; 82 84 this->lifeCycle = 0.0; //! @todo should not be here 83 85 } 84 86 } … … 88 90 */ 89 91 void TestBullet::destroy () 90 {} 92 { 93 94 95 } 91 96 92 97 -
trunk/src/world_entities/weapons/test_bullet.h
r4932 r5257 18 18 virtual ~TestBullet (); 19 19 20 virtual void collidesWith(WorldEntity* entity, const Vector& location); 20 21 virtual void destroy (); 21 22 -
trunk/src/world_entities/world_entity.cc
r5256 r5257 143 143 void WorldEntity::collidesWith(WorldEntity* entity, const Vector& location) 144 144 { 145 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);145 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 146 146 } 147 147
Note: See TracChangeset
for help on using the changeset viewer.