protected void CheckAngleOnExit(UnityEngine.Collision other) { if (PhysicsTools.IsLayerInMask(LayersToCheck, other.gameObject.layer)) { if (currentCollisions.Contains(other.gameObject)) { currentCollisions.Remove(other.gameObject); } } }
protected void CheckAngleOnEnter(UnityEngine.Collision other) { if (PhysicsTools.IsLayerInMask(LayersToCheck, other.gameObject.layer)) { float angle = Vector3.Angle(Vector3.up, other.contacts[0].normal); if (angle <= MaxAngle && !currentCollisions.Contains(other.gameObject)) { currentCollisions.Add(other.gameObject); } } }
private void OnCollisionExit(UnityEngine.Collision other) { if (!allowCollisions) { return; } if (PhysicsTools.IsLayerInMask(LayersToCheck, other.collider.gameObject.layer)) { LastDetectedObject = other; IsTriggered = false; InvokeTriggerExited(); } }
private void OnCollisionEnter(UnityEngine.Collision other) { if (LogTrigger) { UnityEngine.Debug.Log( "Collision with: " + LayerMask.LayerToName(other.collider.gameObject.layer) + " (Is in mask: " + PhysicsTools.IsLayerInMask(LayersToCheck, other.collider.gameObject.layer) + ")", other.gameObject); } if (!allowCollisions) { return; } if (PhysicsTools.IsLayerInMask(LayersToCheck, other.collider.gameObject.layer)) { LastDetectedObject = other; IsTriggered = true; InvokeTriggerEntered(); } }