Skip to content

Trigger condition ​

This page explains under what conditions an object is destroyed (trigger conditions). When using InstantDestructionSimple, there are primarily two methods: "destruction upon collision" and "destruction by calling a method from a script".

Destruction Upon Collision ​

Destruction is automatically triggered when another collider contacts the object.

  • Auto Setup: When the component is added, a BoxCollider fitted to the mesh's size is automatically assigned.
  • Supports OnCollision / OnTrigger: It supports both physical collisions (OnCollisionEnter) and trigger contacts (OnTriggerEnter).
  • Auto-calculation of Explosion Center: Upon collision, the contact point with the target is automatically calculated, and fragments scatter outwards from that origin point.

Destruction via OnTrigger Method Call ​

You can call the method directly from any script to execute destruction at any desired timing.

  • OnTrigger() Executes destruction using the center of the object's bounding box as the origin.
  • OnTrigger(Vector3 expPos) By passing a world coordinate as an argument, it executes destruction using the specified position (such as an explosion point) as the origin. By passing an impact point (RaycastHit.point) detected via raycast (Physics.Raycast), you can create the effect of fragments blowing away from the exact spot where a bullet hit.

Once your trigger conditions are set, proceed to configure the Effects and Sounds to make the destruction look spectacular.