Understanding Unity3d physics: where is the force applied?
I'm trying to understand which is the right way to apply forces to a RigidBody. I noticed that there are AddForce and AddRelativeForce methods, one applied in world space coordinate system meanwhile the other in the local space. The thing that I do not understand is the following: usually in physics library (es. Bullet) we can specify the force vector and also the force application point. How can I do this in Unity? Is it possible to apply a force vector in a specific point relative to the given RigidBody coordinate system? Where does AddForce apply the force?
The documentation isn’t terribly clear on it—and I’m not currently in a position to verify it—but I believe that the force applied from
RigidBody.AddForce() (link) is applied at that object’s root location (at its
transform.position). If not at
transform.position, then at the object’s
If you want to apply a force vector at a specific point, you probably want to use
RigidBody.AddForceAtPosition() (link). Similarly, there is
RigidBody.AddRelativeForce() (link) if you just want it local to the object itself.
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Entertainment & General News
- Games & eSport