public void OnCollisionDetected(TrainController tc) { // TODO: Disable collisions between next and previous completely via physics system. if (tc == next || tc == previous || isDerailed) { return; } if (tc == this) { Debug.LogWarning("OnCollisionDetected with self! " + name + " iid: " + this.GetInstanceID()); } //if(tc._velocity + this._velocity > 2f) if (Vector3.Distance(tc.CalculateVelocityVector(), CalculateVelocityVector()) > 2f) { Derail(); } }