/*! \file physics_interface.h \brief a physics interface simulating a body with a mass */ #ifndef _PHYSICS_INTERFACE_H #define _PHYSICS_INTERFACE_H #include "vector.h" #include "base_object.h" // Forward Declaration class Field; //! A Physics interface /** here can be some longer description of this class */ class PhysicsInterface : virtual public BaseObject { public: PhysicsInterface(); virtual ~PhysicsInterface(); /** \param mass the mass to set for this node. */ inline void setMass( float mass ) { this->mass = mass; }; /** \returns the mass of the node. */ inline float getMass( void ) const { return mass; }; /** \returns the mass of this node plus all its children (only valid for PNodes). */ inline float getTotalMass( void ) const { return mass + massChildren; }; virtual void applyField(Field* field, float dt); virtual void tickPhys( float dt ); protected: void recalcMass(); private: float mass; //!< Mass of this object float massChildren; //!< Sum of the masses of the children nodes Vector forceSum; //!< Total central force for this tick Quaternion momentumSum; //!< Total momentum in this tick }; #endif /* _PHYSICS_INTERFACE_H */