About Function BodyNode::addExt[Force/Torque]

I am confused on the function variables offset , isForceLocal and isOffsetLocal.

What does the offset means and local means ?

i take the offset as (Force application point at world space - COM position of BodyNode at world space), in this case ,shall i set isOffsetLocal = true?

I am not sure whether the understanding is correct.

Further, what does local force means ? a force vector is just a force vector, what to do with local?

All in all ,can you give me some specific examples on how to give force with a application point at world space ??

I failed to find the actual function definition in the source codes… So i have to brother

Thank you

_offset is describes where the force is being applied. Its exact meaning depends on _isOffsetLocal:

  • if _isOffsetLocal == true then _offset describes where the force is being applied relative to the frame of the BodyNode, which is not necessarily the same as its center of mass. When you call the function BodyNode::getLocalCOM(), you will get the location of the center of mass with respect to the frame of the BodyNode.
  • if _isOffsetLocal == false then _offset describes where the force is being applied relative to the world frame.

_isForceLocal refers to what coordinates the force vector is being expressed in. Force vectors are “free vectors” which means that transforming them between coordinate systems just means rotating them.

  • if _isForceLocal == true then _force is a vector express in coordinates of the BodyNode frame.
  • if _isForceLocal == false then _force is a vector expressed in world coordinates.

All in all ,can you give me some specific examples on how to give force with a application point at world space ??

If you want to express both the force vector and offset point in world coordinates, then set both _isForceLocal and _isOffsetLocal to false.

The source code for these functions can be found here.

Thank you for your detailed replay!

Sure, I’m glad I could help!

The documentation for those functions could use some greater detail about what the flags are for.

Well, expert, i face another problem.
I am currently using the getLinearVelocity(offset) function.

I want to get world velocity of a point under world space , should i just pass the offset as the point’s world coordinates( no need to touch the implicit function paramerters of frame)?

Also , i wish the velocity already concerned about the angular velocity, i saw that in the source code,
but i wanna to have a double check from you.

getLinearVelocity(offset) will return the linear velocity (relative to the world, expressed in world coordinates) of a point attached to the BodyNode frame. The offset vector should be a point relative to the origin of the BodyNode frame, expressed in coordinates of the BodyNode frame.

I want to get world velocity of a point under world space

This is the default, for the _relativeTo and _inCoordinatesOf arguments for this function, so you’re fine for this.

should i just pass the offset as the point’s world coordinates

No, the coordinates for offset should still be in the coordinates of the BodyNode frame, relative to the origin of the BodyNode frame.

Also , i wish the velocity already concerned about the angular velocity

Could you clarify what you’re asking for in this sentence?

1 Like

But i only get the point’s world position , how to transform to bodyNode frame?

Emmm…, i want a velocity which is not just linear velocity of the body but also takes the angular velocity of that point into account.
I saw the implementation of the cross product of angular velocity. Just need a double check from you

Thanke you, grey!

If you have a BodyNode* called bn and a p point in the world frame, then use the following code:

bn->getLinearVelocity( bn->getWorldTransform().inverse() * p );

i want a velocity which is not just linear velocity of the body but also takes the angular velocity of that point into account.

BodyNode::getLinearVelocity(offset) will do exactly that, so you have nothing to worry about.

1 Like

Cool! Grey!
You are so nice !