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
RevLine 
[3954]1/*!
[4375]2    \file physics_interface.h
[4121]3    \brief a physics interface simulating a body with a mass
[3954]4*/
5
[4375]6#ifndef _PHYSICS_INTERFACE_H
7#define _PHYSICS_INTERFACE_H
[3954]8
[4376]9#include "vector.h"
[4377]10#include "base_object.h"
[3954]11
[4377]12// Forward Declaration
13class Field;
14
[3961]15//! A Physics interface
[3954]16/**
17   here can be some longer description of this class
18*/
[4382]19class PhysicsInterface : virtual public BaseObject
[4377]20{
[3954]21
22 public:
[4375]23  PhysicsInterface();
24  virtual ~PhysicsInterface();
[4376]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; };
[3954]31
[4377]32  virtual void applyField(Field* field, float dt);
33  virtual void tickPhys( float dt );
[4376]34
[4121]35 protected:
[4376]36  void recalcMass();
37
38 
39 private:
40  float mass;                   //!< Mass of this object
[4221]41  float massChildren;           //!< Sum of the masses of the children nodes
[4376]42  Vector forceSum;              //!< Total central force for this tick
[4221]43  Quaternion momentumSum;       //!< Total momentum in this tick
[4121]44       
[3954]45
46};
47
[4375]48#endif /* _PHYSICS_INTERFACE_H */
Note: See TracBrowser for help on using the repository browser.