I'm currently creating a simple game like the Angry Bird. So I succesfully created something like that and I'm currently facing a problem where in I want to shoot the bird infinitely like if it hits the wall it should just bounce back and if it hits a wall again it will bounce back like infinite.
Here's my shoot code
public float force = 1300;
private void OnMouseUp()
{
// Disable IsKenematic
GetComponent<Rigidbody2D>().isKinematic = false;
// Add the Force
Vector2 dir = startPos - (Vector2)transform.position;
GetComponent<Rigidbody2D>().AddForce(dir * force);
//Remove the script (not the gameobject)
Destroy(this);
}
EDIT
Just to add an information I am using Physics 2D material Friction: 0.8 Bounciness: 0.45