Question by
Creative Inventory · Nov 14, 2015 at 04:57 PM ·
2daddforceforcemode
Player being pulled back by ForceMode2D.Impulse
I have a script attached to a tagged object that pushes my player on trigger. It works perfectly, however my player (after collision) gets dragged back to the tagged object and continues bouncing. How would I stop this. All I want is for my player to get pushed back by the tagged object for a short amount of distance and stay there. Could anyone help me with this?
This is my script:
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Bouncy object")
GetComponent<Rigidbody2D>().AddForce(transform.right * 15, ForceMode2D.Impulse);
}
Comment