Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: PhysicsEngine looks better (it speeds up things… but i do not exactly know if it works

File size: 1.8 KB
RevLine 
[4555]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
[4397]12#ifndef NULL
[4480]13#define NULL 0          //!< NULL
[4397]14#endif
15
[4377]16// Forward Declaration
17class Field;
18
[3961]19//! A Physics interface
[3954]20/**
[4395]21   The PhysicsInterface is an extension to Any other object,
22   that can be used to turn it to be Physcally animated.
23   Still you have to connect fields.
24   IMPORTANT is, that when using PNodes this baseclass is ok.
25   BUT, when using any other class that does not by itself implement
26   PNode you __MUST__ implement all the virtual functions by your own
[3954]27*/
[4382]28class PhysicsInterface : virtual public BaseObject
[4377]29{
[3954]30
31 public:
[4397]32  PhysicsInterface(void* objectPointer);
[4375]33  virtual ~PhysicsInterface();
[4376]34  /** \param mass the mass to set for this node. */
35  inline void setMass( float mass ) { this->mass = mass; };
36  /** \returns the mass of the node. */
37  inline float getMass( void ) const { return mass; };
38  /** \returns the mass of this node plus all its children (only valid for PNodes). */
39  inline float getTotalMass( void ) const { return mass + massChildren; };
[3954]40
[4395]41  virtual void applyField(Field* field);
[4377]42  virtual void tickPhys( float dt );
[4376]43
[4121]44 protected:
[4395]45  virtual void recalcMass();
[4376]46
[4555]47
[4376]48 private:
[4480]49  void*          objectPointer;         //!< A Pointer to the object we handel (actually should be this)
[4558]50
51
[4555]52  float          mass;                  //!< Mass of this object
53  float          massChildren;          //!< Sum of the masses of the children nodes
[4558]54
[4555]55  Vector         forceSum;              //!< Total central force for this tick
56  Quaternion     momentumSum;           //!< Total momentum in this tick
[4558]57  bool           bForceApplied;         //!< If a force was applied to this object.
[3954]58};
59
[4375]60#endif /* _PHYSICS_INTERFACE_H */
Note: See TracBrowser for help on using the repository browser.