How do I revert again to “regular” velocity after a slight increase from hitting a collider mid-air?
personal void OnCollisionEnter2D(Collision2D collision)
{
var Velocity = lastVelocity.magnitude;
var Path = Vector3.Replicate(lastVelocity.normalized, collision.GetContact(0).regular);
rb.velocity = Path * Mathf.Max(Velocity, 0f);
if (collision.gameObject.CompareTag("Blocker"))
{
rb.AddForce(Path * 5f, ForceMode2D.Impulse);
}
}
I am utilizing AddForce
& it really works however the factor is, it would not revert again to regular velocity. I used to be advised to attempt forcemode.impulse
but it surely did not work.