I´m trying to made my 2Dball to increas the velocity on the collision.
public float vplusX; //Set these in inspector
public float vplusY;
void OnCollisionEnter2D(Collision col)
{
gameObject.GetComponent<Rigidbody2D>().velocity += new Vector2(vplusX, vplusY);
}
Alternatively, you can set the velocity increase to be a percentage of current velocity with
public float vpercentage; //1f = 100%
void OnCollisionEnter2D(Collision col)
{
gameObject.GetComponent<Rigidbody2D>().velocity *= (1f + vpercentage)
}