Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/physics/src/util/physics/i_physics.h @ 4221

Last change on this file since 4221 was 4221, checked in by buerlia, 19 years ago

orxonox/branches/physics: addForce function for rigid bodies; made some small functions inline

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*/
15class 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.