/*! \file i_physics.h \brief a physics interface simulating a body with a mass */ #ifndef _I_PHYSICS_H #define _I_PHYSICS_H #include "p_node.h" //! A Physics interface /** here can be some longer description of this class */ class IPhysics : public PNode { public: IPhysics(); virtual ~IPhysics(); inline void setMass( float mass ) { this->mass = mass; }; //!< Set the mass of this node inline float getMass( void ) const { return mass; }; //!< Get the mass of this node inline float getTotalMass( void ) const { return mass + massChildren; }; //!< Get the sum of the masses of this node and all subnodes void addForce( Vector force ); //!< Add a central force on this rigid body void addForce( Vector force, Vector grip ); //!< Add a decentral force on this rigid body void tick( float dt ); //!< Update kinematics, reset force sum protected: void recalcMass(); //!< Recalculate the mass of the children float mass; //!< Mass of this node 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 private: }; #endif /* _I_PHYSICS_H */