Force is applied at object center, and so is torque. An impulse has a world position, but has its own caveats.
Or you can do the transformation yourself using the vector math:
force.cross(radius) = torque
Where both force and radius are vectors. And because force, acceleration, velocity and displacement are all handled the same (mostly) you could replace that with:
linear_displacement.cross(radius) = angular_displacement
There are some other useful rearrangements of this, so if you need a hand, let us know more specifically what you want to move where.
Thanks for all the answers, until now I am not sure if I understood how I could apply that information to my game object.
Here’s a pic of the situation:
The highlighted cube on the ground is the dynamic object. The rotation axis should be around the middle of the player model (for spins and flips -> where the 3d cursor is located).
Unfortunately, I suck at coding, so I am not sure if the provided code is applicable to my dynamic object.
The good news is, that I apply the rotation via a python script (obj.setAngularVelocity([rotationAngleX, rotationAngleY, rotationAngleZ], 1), so the implementation probably will be easier.
So, is the code give above applicable for the situation I want to use it?
P.S. I tried to apply the code but I must admit, I don’t get it at…
I just don’t understand what the code does.
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
target = own.scene.objects['someObject'] #Would this be the Empty acting as the pivot?
if 'pivot' not in target:
pivot = own.scene.addObject('someEmpty',own,0) #Why is here added another empty?
target['pivot'] = pivot #Is pivot assigned to a object's property? What kind of variable is it?
pivot.worldPosition = (pivot point) # What is pivot point?
diff = target.worldPosition - pivot.worldPosition
local = pivot.worldOrientation.inverted()*diff
target['local'] = local #Is this again another objects property called local?
else:
pivot = target['pivot']
pivot.applyRotation(some rot,0)
local = pivot.worldTransform*target['local']
distance, vectTo, localTo = target.getVectTo(local) #what happens down here?
force = distance*distance
target.applyForce(vectTo*force,0)
Yes, exactly, instead of pivoting around the objects origin I want the pivot point to be around the middle of the body of the player model. The bounding box origin has to stay where it is due to the center of mass.