Hi everyone,
I need some help for my fps game.
For example we take a cube as object, without a rigidbody.
Just standard. I need a script that destroy itselfs when it is hit by an object with the tag called “Bullet”.
But how?
Please help
Does the bullet have a rigidbody or anything?
No it doesn’t.
Have a look at:
Unity - Scripting API: Collider (the onTrigger bits)
if you want to only work for some specfic collisions (ie bullet hits cube) you’ll need to check the tags on the “other” object in the onTrigger examples.
If I were you I would add a kinematic rigidbody onto the cube and then use on trigger enter.
I found that myself already.
But it didn’t work for me…
One of them needs a rigid body for OnTriggerEnter to work.
Is there a reason to not have a rigidbody on the bullet and/or cube?