| Line | |
|---|
| 1 | /* |
|---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
|---|
| 3 | |
|---|
| 4 | Copyright (C) 2004 orx |
|---|
| 5 | |
|---|
| 6 | This program is free software; you can redistribute it and/or modify |
|---|
| 7 | it under the terms of the GNU General Public License as published by |
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
|---|
| 9 | any later version. |
|---|
| 10 | |
|---|
| 11 | ### File Specific: |
|---|
| 12 | main-programmer: Benjamin Grauer |
|---|
| 13 | co-programmer: ... |
|---|
| 14 | */ |
|---|
| 15 | |
|---|
| 16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PHYSICS |
|---|
| 17 | |
|---|
| 18 | #include "gravity.h" |
|---|
| 19 | |
|---|
| 20 | #include "util/loading/load_param.h" |
|---|
| 21 | #include "util/loading/factory.h" |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | ObjectListDefinition(Gravity); |
|---|
| 25 | |
|---|
| 26 | CREATE_FACTORY(Gravity); |
|---|
| 27 | |
|---|
| 28 | Gravity::Gravity(const TiXmlElement* root) |
|---|
| 29 | { |
|---|
| 30 | this->registerObject(this, Gravity::_objectList); |
|---|
| 31 | |
|---|
| 32 | if (root != NULL) |
|---|
| 33 | this->loadParams(root); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | /** |
|---|
| 37 | * standard deconstructor |
|---|
| 38 | |
|---|
| 39 | */ |
|---|
| 40 | Gravity::~Gravity () |
|---|
| 41 | { |
|---|
| 42 | // delete what has to be deleted here |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | void Gravity::loadParams(const TiXmlElement* root) |
|---|
| 46 | { |
|---|
| 47 | Field::loadParams(root); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * calculates the Gravity on any point in space |
|---|
| 52 | * @param data The Position of the Point in space to attache gravity to. |
|---|
| 53 | * @returns The force. |
|---|
| 54 | */ |
|---|
| 55 | Vector Gravity::calcForce(const Vector& data) const |
|---|
| 56 | { |
|---|
| 57 | return Vector(0,-1,0) * this->getMagnitude(); |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.