Hi
Can anyone show me an example project for land mines
or scripts for a game object(land mine)
Thanks a lot
Hi
Can anyone show me an example project for land mines
or scripts for a game object(land mine)
Thanks a lot
Do you mean like the Minesweeper game or mines that go off when a character walks on them (for an FPS or something)?
When the FPS player walks on them they blow up.
Thanks
An easy way to do this is to use an object with a trigger (this is just a normal collider with the Is Trigger option enabled). When something enters the object’s trigger, the OnTriggerEnter function will be called on its script. You can then use code in the script to create the effect of the mine explosion:-
function OnTriggerEnter(coll: Collider) {
coll.rigidbody.AddExplosionForce(20, transform.position, 10);
}
The exact code that goes inside OnTriggerEnter depends on exactly what you want to happen in the game. You might set off a Detonator explosion, push a rigidbody away, apply damage to a player, etc…
I did what you said so far but it does nothing, how do you creat a explosion.
Also how do I make the mine disappear after the explosion.
I have a damage script to put on it)
Thanks
Oh wait never mind I did it .
Thanks a lot