- Home /
Show message when gameobject hits other gameobject..
Hi,
Please look at the picture below.
You see a ball, a cube, and a stick. The stick is a child of an empty gameobject. This empty gameobject is in the middle of the ball. With the left/right arrow keys you can rotate the stick around the ball (actually you're rotating the empty gameobject).
The only thing I want to accomplish is to get a message when the stick hits the box.
I thought this would be very simple, but I can't get it to work and don't understand what I am doing wrong. Both the stick and the box have box colliders, but the cube is also set as "is trigger". So I thought it would work with this script:
function OnTriggerStay(other: Collider){
Debug.Log("stick hits cube");
}
Do they also have RigidBody components attached? You'll only get collision/trigger events if at least one of the objects is also a rigidbody.
Your answer
Follow this Question
Related Questions
How do I add force in the on trigger 1 Answer
Change Object's Position OnTrigger 0 Answers
Non-hard-coded object reference? 2 Answers
Load Prefabs in Array with Javascript 1 Answer
How to tell if 2 blocks are next to each other in a 2d game? 1 Answer