|
Last change
on this file since 4357 was
4338,
checked in by bensch, 20 years ago
|
|
orxonox/trunk: merged branches/physics back to the trunk
merged with command
svn merge -r 3866:HEAD . ../../trunk/
many conflict that i tried to resolv
@patrick: i hope i did not interfere with your stuff :/
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file i_physics.h |
|---|
| 3 | \brief a physics interface simulating a body with a mass |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _I_PHYSICS_H |
|---|
| 7 | #define _I_PHYSICS_H |
|---|
| 8 | |
|---|
| 9 | #include "p_node.h" |
|---|
| 10 | |
|---|
| 11 | //! A Physics interface |
|---|
| 12 | /** |
|---|
| 13 | here can be some longer description of this class |
|---|
| 14 | */ |
|---|
| 15 | class IPhysics : public PNode { |
|---|
| 16 | |
|---|
| 17 | public: |
|---|
| 18 | IPhysics(); |
|---|
| 19 | virtual ~IPhysics(); |
|---|
| 20 | |
|---|
| 21 | inline void setMass( float mass ) { this->mass = mass; }; //!< Set the mass of this node |
|---|
| 22 | inline float getMass( void ) const { return mass; }; //!< Get the mass of this node |
|---|
| 23 | inline float getTotalMass( void ) const { return mass + massChildren; }; //!< Get the sum of the masses of this node and all subnodes |
|---|
| 24 | void addForce( Vector force ); //!< Add a central force on this rigid body |
|---|
| 25 | void addForce( Vector force, Vector grip ); //!< Add a decentral force on this rigid body |
|---|
| 26 | void tick( float dt ); //!< Update kinematics, reset force sum |
|---|
| 27 | |
|---|
| 28 | protected: |
|---|
| 29 | void recalcMass(); //!< Recalculate the mass of the children |
|---|
| 30 | float mass; //!< Mass of this node |
|---|
| 31 | float massChildren; //!< Sum of the masses of the children nodes |
|---|
| 32 | Vector forceSum; //!< Total central force for this tick |
|---|
| 33 | Quaternion momentumSum; //!< Total momentum in this tick |
|---|
| 34 | |
|---|
| 35 | private: |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | }; |
|---|
| 39 | |
|---|
| 40 | #endif /* _I_PHYSICS_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.