I'm trying to make it so if my player hits "E" then they jump precisely to a specific target. The current code results in player jumping towards the target but not really making it there.
I've tried adjusting forceMultiply and ForceMode and adding an offset but I just can't get a result that simply consistently launches the player's rigidbody rb
towards the anchorPoint
position.
The code I have is:
private void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
tryGrabbing = true;
}
}
private void FixedUpdate()
{
if (tryGrabbing)
{
rb.AddForce(anchorPoint.transform.position * forceMultiply, ForceMode.Impulse);
}
}
Thank you for any help!!