[Unity/Playmaker] How to destroy an object when it collides

This tutorial will show you how to set up a destruction of a 3D model when it collides with another object. To do this, use the “is_Trigger” setting to set the action to be triggered by the state of the trigger. In this tutorial, we will set the sphere to be destroyed when the bullet hits the sphere.

In my previous article, I have explained how to set up the controller and how to set it to fire bullets, so if you have missed it, please check it out.

First, let’s create a 3D Sphere. This is the target object. Set a collider on this Sphere and set Is Trigger to the selected state. This way, this ball will not block what it hits. However, when an object with a collider is triggered, which is judged by the sphere’s collider.

Please refer to the following article on TRIGGER EVENTS used this time and how to determine if you won.

Next, add the FSM to the sphere. This time, I aim to trigger a sphere destruction action when a bullet hits the sphere in-game, so I set the trigger event action to die and transition to the Dying state, and to the Dying state,

I added a Destroy Self action.

Let’s just make sure the bullet’s prefab has a rigid body and the collider is set.All you have to do is uploading the prefix to STYLY as it is. 銃弾With this you can destroy the sphere by shooting bullets from the gun. In addition to balls, you can add the same settings to enemy characters, for example, and shoot them with a gun.