Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: fields are now time-independant

File size: 1.5 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#include "base_object.h"
11
12// Forward Declaration
13class Field;
14
15//! A Physics interface
16/**
17   The PhysicsInterface is an extension to Any other object,
18   that can be used to turn it to be Physcally animated.
19   Still you have to connect fields.
20   IMPORTANT is, that when using PNodes this baseclass is ok.
21   BUT, when using any other class that does not by itself implement
22   PNode you __MUST__ implement all the virtual functions by your own
23*/
24class PhysicsInterface : virtual public BaseObject
25{
26
27 public:
28  PhysicsInterface();
29  virtual ~PhysicsInterface();
30  /** \param mass the mass to set for this node. */
31  inline void setMass( float mass ) { this->mass = mass; };
32  /** \returns the mass of the node. */
33  inline float getMass( void ) const { return mass; };
34  /** \returns the mass of this node plus all its children (only valid for PNodes). */
35  inline float getTotalMass( void ) const { return mass + massChildren; };
36
37  virtual void applyField(Field* field);
38  virtual void tickPhys( float dt );
39
40 protected:
41  virtual void recalcMass();
42
43 
44 private:
45  float mass;                   //!< Mass of this object
46  float massChildren;           //!< Sum of the masses of the children nodes
47  Vector forceSum;              //!< Total central force for this tick
48  Quaternion momentumSum;       //!< Total momentum in this tick
49       
50
51};
52
53#endif /* _PHYSICS_INTERFACE_H */
Note: See TracBrowser for help on using the repository browser.