private void Awake() { if (visibiliy == null) { visibiliy = this.GetComponent <TossingObject_Visibility>(); } if (physics == null) { physics = this.GetComponent <TossingObject_Physics>(); } }
// Collision Event From Manager public void OnCollisionWithOther(TossingObject_Physics _coll, float _dist) { Vector3 normal = this.transform.position - _coll.transform.position; normal.Normalize(); _coll.AddForce(normal * Vector3.Dot(velocity, normal), 0); this.transform.position = _coll.transform.position + normal * _dist; velocity += Vector3.Reflect(velocity, normal) / mass; }