hello people, i have the following code:
Vector3 grappleDirection = (hit.transform.position - transform.position).normalized;
GetComponent ().AddRelativeForce (grappleDirection * grappleAcceleration);
i want the gameObject to move towards the hit’s position. i cannot use transform.position etc. to move the gameObject it must by the rigidbody.addrelativeforce. the issue is that if i look up, and grapple something above me. the grappleDirection is 0,1,0 which is correct as i normalised it and i only have to travel on the y axis. however when i apply the force i move on the y axis, of the gameObject which is the wrong direction, can anyone help me find a solution to this problem. i could theoretically lock the gameObject’s rotation or something, but an alternate method would be appreciated. thank you
The answer is hexagonius’ comment
using AddForce instead of AddRelativeFore should do it