How do you fix a Rigidbody stopping quickly after the addforce stops being called?
I see a similarly-worded question gets asked a lot, so I'll clear up the confusion: I'm not asking how to quickly stop a rigidbody, i'm asking the opposite: My rigidbody stops abruptly after I stop pressing down a key; I don't want it to lose its momentum.
I've got sort of like a Spiderman/Attack On Titan grapple hook thing going in my game, but I want the character to continue moving forward in between when a first hook gets disconnected by the player and when he fires the second hook.
Here's a snippet of my code:
if (hookEndscript.attached == true) {
iGrapple = GameObject.Find ("hookend 1(Clone)");
Quaternion atHook = Quaternion.LookRotation (iGrapple.transform.position - transform.position);
rb.rotation = atHook;
thrust = thrust * 1.01f;
}
if (hookEndscript.attached == true) {
rb.AddRelativeForce (transform.forward * 10000000);
}
}
}
I've got several other scripts attached, that move the player without using its Rigidbody. None are being called while you're on the grapple hook, however. Could that still be why? If so, Is there an easy fix to that? There's no error, and gravity works but once you disconnect from the hook he just moves slowly down with gravity, and not forward.