Question by
Creative Inventory · Nov 15, 2015 at 04:04 PM ·
triggeraddforcedragback
Rigidbody is being dragged back to bouncy object
I have an object tagged "Bouncy object" that push's my player on collision, it works but after collision my player is like being dragged back to the object tagged "Bouncy object" then does the same thing again like a cycle. The code I used is:
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Bouncy object")
GetComponent<Rigidbody2D>().AddForce(transform.right * 38, ForceMode2D.Impulse);
}
I then set the drag on the players Rigidbody to: 1.49. How would I stop this from happening? What I want is for the object tagged "Bouncy object" to push my player on collision (trigger) then freeze Rigidbody2D for like 2 seconds then allows me to control my player! (sorry if I don't make sense) Thank you!
Comment