- Home /
OnCollisionStay only detects collisions after a secondary collision
The collisions are between a mesh collider and a terrain collider. Box colliders seem to work as expected.
bool quake = false;
void OnGUI (){
if (GUI.Button (new Rect(10,35,200,20), "Earthquake")){
quake= !quake;
}
}
void OnCollisionStay(Collision collisionInfo) {
if(quake){
foreach (ContactPoint contact in collisionInfo.contacts) {
Debug.Log(contact.otherCollider.name);
contact.otherCollider.attachedRigidbody.AddForce(Vector3.up*10);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Two Basic Physic Questions (Gravity and Jumping) 1 Answer
How to hit objects in VR 1 Answer
rigidbody2D.addforce in collider 1 Answer
Need help with scripting bug fix. pleease 0 Answers
Mouse Movement with physics 1 Answer