So here is a quick model of a gameobject.
The black box represents the gameobject. The gameobject has a rigidbody. The red dots indicate the locations forces are being applied, and the red arrows are the directions I want the forces to be applied in.
What I am trying to accomplish is shown in diagram A, however, what is actually happening is shown in diagram B.
The result in diagram B is because of the following code:
player_rigidbody.AddForceAtPosition(strength * Vector3.up, offset);
The Vector3.up causes the force to be applied within the worldspace instead of the localspace. However, I don’t know how to get a Vector3 of the localspace direction.
The only way I could achieve such a result is if I used AddRelativeForce, however, I can’t get the force offset like with AddForceAtPosition.
Soooo, here’s the question:
How can you combine the effects of AddRelativeForce and AddForceAtPosition at once?