- Home /
Trigger Event, Ring Pass thru Rod Object
Hi unitiers,
I am a bit new to unity, and trying to figure out this one question below, tried to spend much time searching on g00gle and other unity forms for possible solutions. But not able to get to a good one.Please help
How to trigger a Event(may be event like debug log msg) , when a Ring (Object) going through a Rod(Object)?
Thanks in advance. buzzanthony.
Answer by Seth-Bergman · May 01, 2012 at 06:48 AM
Here's what I'm envisioning:
the colliders pictured would only be used for the trigger/collision function, and should only be able to connect if the rod goes through
Seth,
I did as mentioned, played around for while, got it working , Superb !!
Thanks alot.
glad I could help!
PS don't forget to thumbs up an answer if it helps!
Answer by Seth-Bergman · May 01, 2012 at 05:24 AM
Not much info to go on, it would help to be specific.. At any rate, you probably want to us a trigger of some kind. If your objects both have a collider on them, you can check "isTrigger" on one of them, and when they come into contact a trigger signal is sent. You can access it in the OnTriggerEnter function, like:
function OnTriggerEnter(other : Collider)
{
//code to do whatever
Debug.Log("activated trigger");
}
if you can be more specific, maybe I could help better
further, if I understand correctly.. I imagine if you were to hide a small box collider inside the mesh of the rod, and another in the center of the ring, then the two could only meet when the rod passed through
Thanks Seth,
Some info : Both objects had colliers proprieties and have rigid body.
Requirement : unless or until the ring goes thru the rod, the trigger needs to be enabled.
The script mention would if collides itself.
Thanks Again.
again, if I'm getting this correctly.. you can create an empty game object, child it to the rod, then add a box collider to it. The collider on the rod itself will handle the physics, while the second childed box collider will act as the trigger. if this second collider is entirely inside the mesh of the rod, it can only be triggered by passing through the ring (provided there is a collider in the center of the ring)..
Answer by buzzanthony · May 01, 2012 at 05:12 PM
it allows to only mark it as correct answer , when trying to thumbs up says
"You don't have permission to do this action. Please Login as another user"
anyway thx.
Because your only have 2 of karma, you need 15 $$anonymous$$imum
that's all I meant, thanks. Also, try to click "add new comment" for comments like this, rather than creating a new answer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613070937im_/https://answers.unity.com/themes/thub/images/avi.jpg)