17 (
"default_terminal_velocity", 400.0f);
26 _terminal_velocity(_default_terminal_velocity),
31 _position.set(0.0f, 0.0f, 0.0f);
32 _last_position = _position;
33 _velocity.set(0.0f, 0.0f, 0.0f);
34 _orientation.set(1.0 ,0.0f, 0.0f, 0.0f);
35 _rotation = LRotation::ident_quat();
58 _process_me = other._process_me;
60 _position = other._position;
61 _last_position = other._last_position;
62 _velocity = other._velocity;
63 _orientation = other._orientation;
64 _rotation = other._rotation;
65 _terminal_velocity = other._terminal_velocity;
66 _oriented = other._oriented;
88 const LVector3 &force) {
89 nassertv(!offset_from_center_of_mass.is_nan());
90 nassertv(!force.is_nan());
92 _orientation.xform(offset_from_center_of_mass),
93 _orientation.xform(force));
105 const LVector3 &force) {
106 nassertv(!offset.is_nan());
107 nassertv(!force.is_nan());
113 PN_stdfloat angle = a.length();
115 LRotation torque(0, 0, 0, 0);
116 PN_stdfloat spin = force.length()*0.1;
119 assert(IS_THRESHOLD_EQUAL(a.length(), 1.0f, 0.001f));
120 torque.set_from_axis_angle(spin, a);
123 LVector3 impulse = (1.0f - angle) * force;
132 LMatrix4 m = LMatrix4::translate_mat(_position);
136 nassertr(!m.is_nan(), m);
146 return LMatrix4::ident_mat();
155 out<<
"PhysicsObject";
166 out<<
""<<
"PhysicsObject "<<_name<<
"\n";
167 out.width(
indent+2); out<<
""; out<<
"_position "<<_position<<
"\n";
168 out.width(
indent+2); out<<
""; out<<
"_last_position "<<_last_position<<
"\n";
169 out.width(
indent+2); out<<
""; out<<
"_velocity "<<_velocity<<
"\n";
171 out.width(
indent+2); out<<
""; out<<
"_orientation "<<_orientation<<
"\n";
172 out.width(
indent+2); out<<
""; out<<
"(hpr "<<_orientation.get_hpr()<<
")\n";
173 out.width(
indent+2); out<<
""; out<<
"_rotation "<<_rotation<<
"\n";
174 out.width(
indent+2); out<<
""; out<<
"_terminal_velocity "<<_terminal_velocity<<
"\n";
175 out.width(
indent+2); out<<
""; out<<
"_mass "<<_mass<<
"\n";
176 out.width(
indent+2); out<<
""; out<<
"_process_me "<<_process_me<<
"\n";
177 out.width(
indent+2); out<<
""; out<<
"_oriented "<<_oriented<<
"\n";