Problem with collision,Problem with colliding
So there is one object that wants to eat another object. It has an on trigger enter, the object takes the furthest one away as a target and starts move to it But the problem is that if it crosses another same object before getting to the target, it triggers the action and the target disappears before the object even gets there. they are instantiated from prefabs so they are identical objects (targets)
So the action that we want is that the object goes through any other objects, not triggering anything before getting to the target. But now the action is triggered from any object not just the target. ,
Answer by spencerz · Feb 27, 2020 at 11:19 AM
If I understand correctly, your object is getting destroyed because its colliding with other objects before it gets to your target? If so, why don’t you just assign a tag to your target?
If (collision.gameObject.tag == “Target”)
// destroy target
Your answer
Follow this Question
Related Questions
OnTrigger Problems Between Colliders Issue 1 Answer
My OnTriggerEnter2D(Collider2D other) not working 1 Answer
confusion on OnTriggerEnter(Collider collision) 0 Answers
Lose Health when GameObject enters collider? (OnTriggerEnter) 2 Answers
How to deadtivate a gameobjects from the scene, if player has a character controller 0 Answers