OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
function OnCollisionStay(collisionInfo : Collision) { // Debug-draw all contact points and normals for (var contact : ContactPoint in collisionInfo.contacts) { Debug.DrawRay(contact.point, contact.normal, Color.white); } }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnCollisionStay(Collision collisionInfo) { foreach (ContactPoint contact in collisionInfo.contacts) { Debug.DrawRay(contact.point, contact.normal, Color.white); } } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnCollisionStay(collisionInfo as Collision) as void: for contact as ContactPoint in collisionInfo.contacts: Debug.DrawRay(contact.point, contact.normal, Color.white)