applyForce() on RigidBodyControl — which coordinate space?

When I have setApplyPhysicsLocal(true), are the locations and directions for forces applied through applyForce() expressed in the coordinate space of the controller or in the space of its PARENT NODE?

i.e., if my RigidBodyControl is an airplane banked left, and a giant is pushing with 5 newton force is pressing down (down from the PILOT’S perspective, not directly down toward the earth) 2m out on my right wing, might this be expressed as

plane.applyForce(new Vector3f(0f, -5f, 0f), new Vector3f(2f, wingYInPlaneModel, wingZInPlaneModel));

or do I have to transform the two vectors to be expressed in the coordinate space of the Node that is the parent of my plane?


No, always global, as said in the manual.

Is there a manual, as such? While I can find plenty of resources (Javadoc, source code, wiki, forums, tutorials, example programs), I haven’t found mention of the detail I’m inquiring after.

The Javadoc for RigidBodyControl offers these two methods:

public void applyForce(Vector3f force,
Vector3f location)
Apply a force to the PhysicsRigidBody, only applies force if the next physics update call updates the physics space.
To apply an impulse, use applyImpulse, use applyContinuousForce to apply continuous force.
force - the force
location - the location of the force

public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
When set to true, the physics coordinates will be applied to the local translation of the Spatial instead of the world traslation.
applyPhysicsLocal -

Does function number 2 do nothing? If not, can you answer the original question as to how “applyPhysicsLocal(true)” causes the vectors to be interpreted? Are they expressed in the controlled object’s coordinate system, or in its parent’s coordinate system?


Normen, I am now working in world space and hoping to make progress. However, can you please answer my question regarding the function (or lack of functionality) in using applyPhysicsLocal(true)?

I would love to help beef up the Javadocs so they more readily avoid confusion like my own.


ApplyPhysicsLocal doesn’t change the behavior of the physics engine, only how the results are applied to the geometry that the physics controls are attached to. This function is mainly there to make local physics systems that can move around on the screen in relation to other things by moving the node, like for example a train or a plane. The actual physics space still works in world space. See TestApplyPhysicsLocal. Our documentation is available via the link on top btw, form there you should find the way to tutorials, code examples, docs, explanations, further links, basically everything and more than you asked for.

Could you please explain this in more details ? Or point to some documentation. I’ve not read anything about that yet.
Thanks !

Theres the physics rigidbody, it has a transform. In apply local mode, that transform is set to the LocalTransform of the spatial, in normal mode its applied to the WorldTransform of the spatial, idk what I can explain more?

Thanks for the explanation. I think I will have to look at this after a bit of sleeping… And maybe try it out on some example to well understand the difference.

Normen … your explanation here above is vastly more informative than the Javadoc. I am sure that confusion and reliance on the forums would diminish if these were explained in concise clear terms in the Javadoc.

And where do you think that should be put? Better read the physics tutorials and documentation, we can’t squish all that in the javadoc at all kinds of places and keep it updated. Also you have the source if you prefer to work on that level. Did you notice you were looking at two different classes’ methods?