00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "Physical.h"
00013 using namespace OpenCAL;
00014
00015 using namespace std;
00016
00017
00018
00019 #define VERYBIG 9999999999999.99999f
00020
00021
00022
00023
00024
00025
00026 Physical::Physical(float mass)
00027 {
00028 #ifdef VERBOSE
00029 Debug::print("Physical constructor", 2);
00030 #endif // VERBOSE
00031
00032 m_oneOverMass = mass > 0 ? 1.0f / mass : VERYBIG;
00033 }
00034
00035 Physical::~Physical()
00036 {
00037 #ifdef VERBOSE
00038 Debug::print("Physical destructor", 2);
00039 #endif // VERBOSE
00040 }
00041
00042
00043
00044
00045
00046
00047 float Physical::getMass() const
00048 {
00049 return m_oneOverMass > 0 ? 1.0f / m_oneOverMass : VERYBIG;
00050 }
00051
00052 void Physical::setMass(float mass)
00053 {
00054 m_oneOverMass = mass > 0 ? 1.0f / mass : VERYBIG;
00055 }
00056
00057 void Physical::setAccelleration(const Vector3 &acceleration)
00058 {
00059 if(m_oneOverMass > 0)
00060 m_force = acceleration / m_oneOverMass;
00061 }