protected bool IsValidTriggerEnter(Collider other) { if (other.isTrigger) { return(false); } if (other.attachedRigidbody == null) { return(false); } if (this.rigidbodyMap.ContainsKey(other)) { SIGVerseLogger.Warn("This Collider has already been added. (" + this.GetType().FullName + ") name=" + SIGVerseUtils.GetHierarchyPath(other.transform)); return(false); } return(true); }
private void ExecCollisionProcess(Collision collision) { float collisionVelocity = this.colliderVelocities[Array.IndexOf(this.colliders, collision.contacts[0].thisCollider)]; SIGVerseLogger.Info("CollisionDetector Collision Detection! Time=" + Time.time + ", Collision Velocity=" + collisionVelocity + ", Part=" + collision.contacts[0].thisCollider.name + ", Collided object=" + SIGVerseUtils.GetHierarchyPath(collision.collider.transform)); // Effect GameObject effect = MonoBehaviour.Instantiate(this.collisionEffect); Vector3 contactPoint = SIGVerseUtils.CalcContactAveragePoint(collision); effect.transform.position = contactPoint; effect.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); Destroy(effect, 1.0f); // Sound this.collisionAudioSource.PlayOneShot(this.collisionClip); // Send the collision notification foreach (GameObject destination in this.collisionNotificationDestinations) { ExecuteEvents.Execute <IRobotCollisionHandler> ( target: destination, eventData: null, functor: (reciever, eventData) => reciever.OnRobotCollisionEnter(collision, collisionVelocity, 0.5f) ); } this.collidedTime = Time.time; }
protected bool IsValidTriggerExit(Collider other) { if (other.isTrigger) { return(false); } if (other.attachedRigidbody == null) { return(false); } if (!this.rigidbodyMap.ContainsKey(other)) { SIGVerseLogger.Warn("This Collider does not exist in the Dictionary. (" + this.GetType().FullName + ") name=" + SIGVerseUtils.GetHierarchyPath(other.transform)); return(false); } return(true); }