How to destroy an object in STYLY through Playmaker


In this tutorial we will learn how we can destroy a 3D model when it collides with other objects in game. For that purpose, we use is_Trigger in unity 3D and we check the is_Trigger property on that object in which we want to perform some action. In this tutorial, I want to destroy a sphere when a bullet hits it. Make sure you have read previous tutorials on how to access controller and how to fire bullets.
  •   Firstly, create a 3D sphere. That's my target object. 'Now, add a collider and also check the Is Trigger property. Now, the sphere will not block anything. When anything with a collider touches it, the spheres collider will detect that.



  • After that we add a FSM to the sphere. I added action: Trigger Event in my game as I want to destroy Sphere when a bullet enters in its collider so I added transition of die and lead it to Dying state. 




  •         In Dying I added an action of Destroy Self.






  •  I already showed how to create bullets in my previous tutorial. Just make sure the bullet prefab has a Rigid body and collider in it.




  •   Then I simply uploaded my prefab to STYLY. Now I shoot from my gun and also destroy that sphere. You can add anything as enemy and shoot that with your gun.


Comments