Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/physics/physics_interface.h @ 4376

Last change on this file since 4376 was 4376, checked in by bensch, 19 years ago

orxonox/trunk: started reimplementing the PhysicsInterface-class. This might just get bad :)

File size: 1.2 KB
Line 
1/*!
2    \file physics_interface.h
3    \brief a physics interface simulating a body with a mass
4*/
5
6#ifndef _PHYSICS_INTERFACE_H
7#define _PHYSICS_INTERFACE_H
8
9#include "vector.h"
10
11//! A Physics interface
12/**
13   here can be some longer description of this class
14*/
15class PhysicsInterface {
16
17 public:
18  PhysicsInterface();
19  virtual ~PhysicsInterface();
20  /** \param mass the mass to set for this node. */
21  inline void setMass( float mass ) { this->mass = mass; };
22  /** \returns the mass of the node. */
23  inline float getMass( void ) const { return mass; };
24  /** \returns the mass of this node plus all its children (only valid for PNodes). */
25  inline float getTotalMass( void ) const { return mass + massChildren; };
26
27  virtual void applyForce( Vector force );                                      //!< Add a central force on this rigid body
28  virtual void tickPhys( float dt );                                            //!< Update kinematics, reset force sum
29
30 protected:
31  void recalcMass();
32
33 
34 private:
35  float mass;                   //!< Mass of this object
36  float massChildren;           //!< Sum of the masses of the children nodes
37  Vector forceSum;              //!< Total central force for this tick
38  Quaternion momentumSum;       //!< Total momentum in this tick
39       
40
41};
42
43#endif /* _PHYSICS_INTERFACE_H */
Note: See TracBrowser for help on using the repository browser.