|
|
@@ -29,7 +29,8 @@ set_mass(float m) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function : set_position
|
|
|
// Access : Public
|
|
|
-// Description : Vector position assignment
|
|
|
+// Description : Vector position assignment. This is also used as
|
|
|
+// the center of mass.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void PhysicsObject::
|
|
|
set_position(const LPoint3f &pos) {
|
|
|
@@ -108,6 +109,20 @@ set_velocity(float x, float y, float z) {
|
|
|
_velocity.set(x, y, z);
|
|
|
}
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function : add_torque
|
|
|
+// Access : Public
|
|
|
+// Description : Adds an torque force (i.e. an instantanious change
|
|
|
+// in velocity). This is a quicker way to get the
|
|
|
+// angular velocity, add a vector to it and set that
|
|
|
+// value to be the new angular velocity.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE void PhysicsObject::
|
|
|
+add_torque(const LRotationf &torque) {
|
|
|
+ nassertv(!torque.is_nan());
|
|
|
+ _rotation+=torque;
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function : add_impulse
|
|
|
// Access : Public
|
|
|
@@ -118,6 +133,7 @@ set_velocity(float x, float y, float z) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE void PhysicsObject::
|
|
|
add_impulse(const LVector3f &impulse) {
|
|
|
+ nassertv(!impulse.is_nan());
|
|
|
_velocity+=impulse;
|
|
|
}
|
|
|
|