hello everyone In my game there is a floor which I want to destroy when a empty game object touches it I have a script but it needs rigidbody to either one of the object so I need a code to destroy it without having rigidbody please help me
Hi - you didn’t provide that much information how you have setup your things - despite of this, here’s something you could do; if you don’t want to use triggers or collision provided by Unity physics system, you could just detect objects position or use raycasting.
Here’s one example of detecting something with raycasting:
For non-raycasting based check, you could maybe use bounds: Unity - Scripting API: Bounds
When object is in certain area or fills some other condition, call your method:
MyOnCollisionHappened(transform.gameObject);
Your method could simply be something like this:
public void MyOnCollisionHappened (GameObject target)
{
Destroy(target);
}