What spaces are the arguments for AddForceAtPosition() in?

I wish to add a force at a position on my rigidbody, so naturally I turn to AddForceAtPosition(). Unfortunately the documentation doesn’t tell me in what space (object- or world-space) the arguments are given.

I have an object-space position at which I wish to add a force. For the sake of simplicity, I shall say it is Vector3.forward in object-space, or transform.forward in world-space.

I have a force which I wish to add, and my code calculates this force in world-space. For the sake of simplicity, I shall say that it is Vector3.up in world-space, or transform.InverseTransformDirection(Vector3.up) in object-space.

I do not know which coordinate system to use to present the arguments to AddForceAtPosition().

Judging from the example given in the documentation, I’m assuming it’s world space (otherwise in the example I would think it would be Vector3.zero instead of transform.position).

Why don’t you just try both, and see which one works as expected?

Both arguments are world-space.

Thanks for the answers, it is appreciated.

The reason why I don’t just try… Well, I did. Repeatedly. But there’s a problem in my code so the forces are screwy. Ever tried troubleshooting force calculation problems when you’re not sure which spaces you’re working in? :smile: You can’t straighten out either problem until you’ve solved one of them! And these answers just solved one, so thank you both of you.