Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: BaseObject virtual public in PNode and Player(for test).
This is, so only one Object of type BaseObject is being created when deriving with multiple inheritance

@patrick: read it in a book at the lake today :)

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#include "base_object.h"
11
12// Forward Declaration
13class Field;
14
15//! A Physics interface
16/**
17   here can be some longer description of this class
18*/
19class PhysicsInterface : virtual public BaseObject
20{
21
22 public:
23  PhysicsInterface();
24  virtual ~PhysicsInterface();
25  /** \param mass the mass to set for this node. */
26  inline void setMass( float mass ) { this->mass = mass; };
27  /** \returns the mass of the node. */
28  inline float getMass( void ) const { return mass; };
29  /** \returns the mass of this node plus all its children (only valid for PNodes). */
30  inline float getTotalMass( void ) const { return mass + massChildren; };
31
32  virtual void applyField(Field* field, float dt);
33  virtual void tickPhys( float dt );
34
35 protected:
36  void recalcMass();
37
38 
39 private:
40  float mass;                   //!< Mass of this object
41  float massChildren;           //!< Sum of the masses of the children nodes
42  Vector forceSum;              //!< Total central force for this tick
43  Quaternion momentumSum;       //!< Total momentum in this tick
44       
45
46};
47
48#endif /* _PHYSICS_INTERFACE_H */
Note: See TracBrowser for help on using the repository browser.