Unity3D : Find and Destroy Untouched Objects to Floor

Viewed 26

I have a question about find and destroy 3D objects which is not collided with floor (Plane). But objects can't need collide directly with the floor. They can collide with neighbour objects.

Example.

A 0bject colliding with B object and B object colliding with floor (return true) A object colliding with C object but C not colliding with floor (return false)

Is there anyone who can help ?

Best Regards

enter image description here

1 Answers

If an object would collide with the floor tag it with a boolean, then if a object collides with another object check if the other object is tagged with said boolean if so tag the other object as well.

So if Object A is colliding with the floor, tag it with a boolean saying it is touching the floor.

Then when Object B is colliding with Object A, check if Object A has this floor tag.

If it does Object B should also be tagged.

If it does not Object B is not colliding with an object colliding with the floor, so do nothing.

Related