using UnityEngine; using System.Collections; public class Bouncing_Surface : MonoBehaviour{ [Header("The default bouncing system will return kinnetick energy to any incoming object based on it's incoming angle and the strength of the bouncing surface")] public int strength; [Header("The spring option will instead add aditional force based on the bouncing point orientation, not the incoming angle of the object")] public bool Spring=true; //public bool Angular_Acelerator=false; void OnCollisionEnter (Collision col){ if(col.gameObject.GetComponent()){ if(Spring){ col.gameObject.GetComponent().linearVelocity = col.gameObject.GetComponent().linearVelocity+this.transform.up*strength; } /*else if(Angular_Acelerator){ Vector3 Angle = (col.contacts[0].point - transform.position)/2; col.gameObject.GetComponent().AddForce(Angle*strength); }*/ else{ Vector3 Angle = col.contacts[0].point - transform.position; col.gameObject.GetComponent().AddForce(col.gameObject.GetComponent().linearVelocity*strength); } } } }