- Home /
Triggers Interacting with Triggers
Hello everybody and good day.
I have a red and green set of ships, that I want to start destroying each other once they enter each other's triggers.
What I have that doesn't work:
Each ship has a PolygonCollider2D, Rigidbody2D, CircleCollider2D (large circle) with trigger checked,
Currently I am trying to use a OnTriggerEnter2D(Collider2D other) to initiate the attack. But am not getting response from OnTriggerEnter2D, could someone point out for me what the correct combination of Rigidbody2D, Colliders2D and triggers should be?
I'm 90% sure triggers can't be made to raise events from colliding with other triggers. (Not sure if that's what you meant) Also, if a trigger can move, it needs a kinematic Rigidbody attached.
@AlwaysSunny I saw from two other questions, replies that implied Triggers could interact if they also had Rigidbodies attached, but I wasn't sure from the documentation, so perhaps misunderstood. I will look into it more.
Currently the prefabs all have kinematic rigidbodies attached.
I was also thinking perhaps if the CircleCollider2D triggers can't interact with each other, maybe they could interact with PolygonCollider2D as it doesn't have triggers checked, though that is also not currently working.
I have a pretty basic concept of this all, so I imagine I might need to approach my problem in a different manner.
I used kinematic rigidbody triggers on my lava balls for a volcano I made. When they entered the water, another trigger, I made the hot glow surrounding them (a texture) disable using a trigger event. So yes you can have two triggers interacting with each other.
Just double checked this and it is definitely how I did it, the water trigger is just a normal trigger with no rigidbody, the lava ball is how I said, and the script is just a normal OnTriggerEnter script attached to the lava ball.
You can move a trigger anyway you want to, it is still attached to an object that has a transform...
$$anonymous$$y bad, guys. Guess I was 90% wrong! That said, I'm quite certain that triggers that move should always have a kinematic rigidbody. It may work without one, and in light-duty cases it won't matter, but performance is improved because of how the physics system handles moving objects.
Not looked into the performance side of moving triggers without a rigidbody so AlwaysSunny may well be right about that.
Your answer
Follow this Question
Related Questions
OnMouseDrag issue, Event System 0 Answers
I can't get 2DCollider to work. 1 Answer
Spike Player Die 0 Answers
OnTriggerEnter Not Working 1 Answer
Trigger not getting GameObject 2 Answers