Types of forces
Panda3D provides two types of forces that you can apply to an object.
LinearVectorForce treats the object as a point mass.
It applies an acceleration in Newtons to the center of mass of the object it was
added to. The direction of this force is relative to the orientation of the
ForceNode that the
LinearVectorForce was applied to.
PT(LinearForce) lvf = new LinearVectorForce(1, 0, 0); // Push 1 newton in the positive-x direction force_node->add_force(lvf); // Determine coordinate space of this force node actor_node->get_physical(0)->add_linear_force(lvf); // Add the force to the object
AngularVectorForce applies a torque to the object
it is attached to. The acceleration is in Newtons, and
AngularVectorForce may be treated in much the same way
LinearVectorForce. There are, however, some minor
differences that that should be taken into account.
AngularVectorForce does not have a
.setDependantMass(). The reason for this is simple: mass must be used in
the torque calculations. As such, you will want to make sure your forces are
sufficiently small or your masses are sufficiently large to keep your rotational
PT(AngularForce) avf = new AngularVectorForce(1, 0, 0); // Spin around the positive-x axis force_node->add_force(avf); // Determine which positive-x axis we use for calculation actor_node->get_physical(0)->add_angular_force(avf); // Add the force to the object