} // OnActiveChanged /// <summary> /// When a collision is detected fire the proper handler in every script attached to the game object. /// </summary> private void OnInitialCollisionDetected(EntityCollidable entity, Collidable collidable, CollidablePairHandler pair) { foreach (var script in Owner.Scripts) { GameObject3D go = (GameObject3D)collidable.Tag; script.OnCollisionEnter(go, pair.Contacts); } } // OnInitialCollisionDetected
} // OnCollisionEnded /// <summary> /// When a collision is still occurring fire the proper handler in every script attached to the game object /// </summary> private void OnPairTouched(EntityCollidable entity, Collidable collidable, CollidablePairHandler pair) { foreach (var script in Owner.Scripts) { GameObject3D go = (GameObject3D)collidable.Tag; script.OnCollisionStay(go, pair.Contacts); } } // OnPairTouched
/// <summary> /// OnCollisionStay is called once per frame for every rigidbody that is touching another rigidbody. /// </summary> /// <param name="gameObject">The GameObject whose collider we are colliding with</param> /// <param name="contacts">The contact points generated by the physics engine.</param> public virtual void OnCollisionStay(GameObject3D gameObject, ContactCollection contacts) { }