Changeset 4186 in orxonox.OLD for orxonox/branches/physics/src
- Timestamp:
- May 14, 2005, 10:57:14 PM (20 years ago)
- Location:
- orxonox/branches/physics/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/lib/graphics/particles/particle_system.cc
r4182 r4186 249 249 \brief applies some force to a Particle. 250 250 */ 251 void ParticleSystem::applyField( Field* field)251 void ParticleSystem::applyField(float dt, Field* field) 252 252 { 253 253 Particle* tickPart = particles; 254 254 while (tickPart) 255 255 { 256 tickPart->extForce += field->calcForce( tickPart->position);256 tickPart->extForce += field->calcForce(dt, tickPart->position); 257 257 tickPart = tickPart->next; 258 258 } -
orxonox/branches/physics/src/lib/graphics/particles/particle_system.h
r4182 r4186 70 70 void setMass(float mass, float randomMass); 71 71 72 void applyField( Field* field);72 void applyField(float dt, Field* field); 73 73 74 74 void tick(float dt); -
orxonox/branches/physics/src/story_entities/world.cc
r4184 r4186 492 492 493 493 494 ParticleSystem* system = new ParticleSystem(10000 0, PARTICLE_SPARK);494 ParticleSystem* system = new ParticleSystem(10000, PARTICLE_SPARK); 495 495 system->setLifeSpan(5); 496 496 system->setConserve(.9); 497 497 system->setRadius(2, 0, 2, 0); 498 498 499 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_ 2, 5000, 1);499 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 1000, 0); 500 500 emitter->setParent(this->localPlayer); 501 501 502 502 Field* twirl = new Twirl(); 503 twirl->setMagnitude( .0001);503 twirl->setMagnitude(-.1); 504 504 Field* gravity = new PointGravity(); 505 gravity->setMagnitude(0 .0001);505 gravity->setMagnitude(0); 506 506 new PhysicsConnection(system, twirl); 507 new PhysicsConnection(system, gravity);508 twirl->setParent(this->local Player);507 // new PhysicsConnection(system, gravity); 508 twirl->setParent(this->localCamera->getTarget()); 509 509 gravity->setParent(this->localCamera->getTarget()); 510 510 particleEngine->addConnection(emitter, system); -
orxonox/branches/physics/src/util/physics/fields/field.h
r4180 r4186 39 39 40 40 /** 41 \param dt The time over which to apply the force 41 42 \param data This is the data given to this force, to calculate the ForceVector 42 43 \returns The Force Vector 43 44 */ 44 virtual Vector calcForce( const Vector& data) const = 0;45 virtual Vector calcForce(float dt, const Vector& data) const = 0; 45 46 46 47 void setMagnitude(const float& magnitude); -
orxonox/branches/physics/src/util/physics/fields/gravity.cc
r4180 r4186 45 45 \returns The force. 46 46 */ 47 Vector Gravity::calcForce( const Vector& data) const47 Vector Gravity::calcForce(float dt, const Vector& data) const 48 48 { 49 return /*(this->getAbsDir().apply(Vector(0,1,0)))*/ Vector(0,-1,0) * this->getMagnitude() ;49 return /*(this->getAbsDir().apply(Vector(0,1,0)))*/ Vector(0,-1,0) * this->getMagnitude() * dt; 50 50 } 51 51 -
orxonox/branches/physics/src/util/physics/fields/gravity.h
r4180 r4186 21 21 virtual ~Gravity(); 22 22 23 virtual Vector calcForce( const Vector& data) const;23 virtual Vector calcForce(float dt, const Vector& data) const; 24 24 25 25 private: -
orxonox/branches/physics/src/util/physics/fields/point_gravity.cc
r4184 r4186 45 45 \returns The force. 46 46 */ 47 Vector PointGravity::calcForce( const Vector& data) const47 Vector PointGravity::calcForce(float dt, const Vector& data) const 48 48 { 49 return (this->getAbsCoor() - data) * this->getMagnitude() ;49 return (this->getAbsCoor() - data) * this->getMagnitude() * dt; 50 50 } 51 51 -
orxonox/branches/physics/src/util/physics/fields/point_gravity.h
r4184 r4186 21 21 virtual ~PointGravity(); 22 22 23 virtual Vector calcForce( const Vector& data) const;23 virtual Vector calcForce(float dt, const Vector& data) const; 24 24 25 25 private: -
orxonox/branches/physics/src/util/physics/fields/twirl.cc
r4184 r4186 45 45 \returns The force. 46 46 */ 47 Vector Twirl::calcForce( const Vector& data) const47 Vector Twirl::calcForce(float dt, const Vector& data) const 48 48 { 49 49 return /*this->getAbsDir()*/ Vector(0,1,0).cross(this->getAbsCoor() - data) 50 * this->getMagnitude() ;50 * this->getMagnitude() * dt; 51 51 } 52 52 -
orxonox/branches/physics/src/util/physics/fields/twirl.h
r4184 r4186 21 21 virtual ~Twirl(); 22 22 23 virtual Vector calcForce( const Vector& data) const;23 virtual Vector calcForce(float dt, const Vector& data) const; 24 24 25 25 private: -
orxonox/branches/physics/src/util/physics/physics_connection.cc
r4183 r4186 45 45 /** 46 46 \brief applies the Force to some Object. 47 \param dt The time to apply in Seconds 47 48 */ 48 void PhysicsConnection::apply( void) const49 void PhysicsConnection::apply(const float& dt) const 49 50 { 50 51 switch(this->type) … … 55 56 56 57 case PCON_ParticlesField: 57 this->particleSystem->applyField( this->field);58 this->particleSystem->applyField(dt, this->field); 58 59 59 60 break; -
orxonox/branches/physics/src/util/physics/physics_connection.h
r4183 r4186 29 29 virtual ~PhysicsConnection(); 30 30 31 void apply( void) const;31 void apply(const float& dt) const; 32 32 33 33 private: -
orxonox/branches/physics/src/util/physics/physics_engine.cc
r4183 r4186 95 95 while (enumConn) 96 96 { 97 enumConn->apply( );97 enumConn->apply(dt); 98 98 enumConn = iterator->nextElement(); 99 99 }
Note: See TracChangeset
for help on using the changeset viewer.