15 #include "linearFrictionForce.h"
16 #include "config_physics.h"
69 assert(_coef>=0.0f && _coef<=1.0f);
72 physics_debug(
" v "<<v<<
" len "<<v.
length()
73 <<
" friction "<<friction<<
" len "<<friction.
length()
74 <<
" dot "<<(normalize(v).dot(normalize(friction))));
76 || IS_NEARLY_EQUAL(normalize(v).dot(normalize(friction)), -1.0f));
93 out<<
"LinearFrictionForce";
104 write(ostream &out,
unsigned int indent)
const {
106 out.width(indent); out<<
""; out<<
"LinearFrictionForce:\n";
107 out.width(indent+2); out<<
""; out<<
"_coef "<<_coef<<
":\n";
Friction-based drag force.
LVector3 get_velocity() const
Velocity Query per second.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
A body on which physics will be applied.
static const LVector3f & zero()
Returns a zero-length vector.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
LinearFrictionForce(PN_stdfloat coef=1.0f, PN_stdfloat a=1.0f, bool m=false)
Constructor.
A force that acts on a PhysicsObject by way of an Integrator.
float length() const
Returns the length of the vector, by the Pythagorean theorem.
bool almost_equal(const LVecBase3f &other, float threshold) const
Returns true if two vectors are memberwise equal within a specified tolerance.
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
TypeHandle is the identifier used to differentiate C++ class types.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
virtual ~LinearFrictionForce()
destructor