55 LVector3 LinearFrictionForce::
58 assert(_coef>=0.0f && _coef<=1.0f);
60 LVector3 friction = v * -_coef;
61 physics_debug(
" v "<<v<<
" len "<<v.length()
62 <<
" friction "<<friction<<
" len "<<friction.length()
63 <<
" dot "<<(normalize(v).dot(normalize(friction))));
64 assert(friction.almost_equal(LVector3::zero())
65 || IS_NEARLY_EQUAL(normalize(v).dot(normalize(friction)), -1.0f));
78 out<<
"LinearFrictionForce";
88 out.width(
indent); out<<
""; out<<
"LinearFrictionForce:\n";
89 out.width(
indent+2); out<<
""; out<<
"_coef "<<_coef<<
":\n";
Friction-based drag force.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A body on which physics will be applied.
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.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
LVector3 get_velocity() const
Velocity Query per second.
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual ~LinearFrictionForce()
destructor