Changeset 4728 in orxonox.OLD for orxonox/trunk/src/lib/physics/physics_connection.cc
- Timestamp:
- Jun 28, 2005, 11:56:46 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/physics/physics_connection.cc
r4597 r4728 24 24 #include "physics_interface.h" 25 25 26 #include "factory.h" 27 26 28 using namespace std; 29 30 CREATE_FACTORY(PhysicsConnection); 27 31 28 32 /** … … 39 43 } 40 44 45 PhysicsConnection::PhysicsConnection(const TiXmlElement* root) 46 { 47 this->setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection"); 48 this->type = PCON_PhysIField; 49 50 static_cast<BaseObject*>(this)->loadParams(root); 51 52 LoadParam<PhysicsConnection>(root, "subject", this, &PhysicsConnection::setSubject) 53 .describe("set the subject by a name"); 54 55 LoadParam<PhysicsConnection>(root, "field", this, &PhysicsConnection::setField) 56 .describe("set the field by name"); 57 } 41 58 42 59 /** … … 50 67 51 68 /** 69 \param subjectName the name of the Subject for this PhysicsConnection 70 */ 71 void PhysicsConnection::setSubject(const char* subjectName) 72 { 73 this->subject = PhysicsEngine::getInstance()->getPhysicsInterfaceByName(subjectName); 74 if (this->subject == NULL) 75 PRINTF(2)("subject: (%s) not found for PhysicsConnection\n", subjectName); 76 } 77 78 /** 79 \param fieldName the Name of the Field for this connection 80 */ 81 void PhysicsConnection::setField(const char* fieldName) 82 { 83 this->field = PhysicsEngine::getInstance()->getFieldByName(fieldName); 84 if (this->field == NULL) 85 PRINTF(2)("field: (%s) not found for PhysicsConnection\n", fieldName); 86 } 87 88 /** 52 89 \brief applies the Force to some Object. 53 90 */ 54 91 void PhysicsConnection::apply(void) const 55 92 { 56 if (likely(this->type == PCON_PhysIField && this->field->getMagnitude() != 0.0)) 93 if (likely(this->type == PCON_PhysIField && this->field->getMagnitude() != 0.0 94 && this->subject != NULL && this->field != NULL)) 57 95 this->subject->applyField(this->field); 58 96 else ;
Note: See TracChangeset
for help on using the changeset viewer.