void OnCollisionEnter(Collision other)
{
//Check if you have to be specific to an object to bounce
this.transform.rigidbody.velocity = Vector3.Reflect(other.relativeVelocity*-1, other.contacts[0].normal );
}
void OnCollisionEnter(Collision other)
{
//Check if you have to be specific to an object to bounce
this.transform.rigidbody.velocity = Vector3.Reflect(other.relativeVelocity*-1, other.contacts[0].normal );
}
void Update()
{
// 2 - Movement
movement = new Vector2(
speed.x * direction.x,
speed.y * direction.y);
}
void FixedUpdate()
{
GetComponent<Rigidbody2D> ().velocity = movement;
}
void OnCollisionEnter(Collision other)
{
//Check if you have to be specific to an object to bounce
this.transform.Getcomponent<Rigidbody2D>().velocity = Vector2.Reflect(other.relativeVelocity*-1, other.contacts[0].normal)
}
}