Hi
If I add a force using the AddForceToPosition method and that force is off-centre, then it causes both movement and torque to the rigidbody:
public Vector3 pos=new Vector3(0,0,40);
public Vector3 forceXYZ=new Vector3(0,0,0);
void FixedUpdate () {
rigidbody.AddForceAtPosition(forceXYZ, transform.position - pos);
}
However, my code does not take into account the rotation of the object, so the force is always being applied at 40units from transform centre. After the rigidbody has rotated more say 45 degrees, I don’t even understand what’s going on anymore.
I want to maintain the force’s position WITHIN the object’s local coordinate system. What is the best method to use? (For now, the force direction can stay in world coordinates).
I have a feeling this is going to involve those dreaded quaternions…