Example Use Case: You have a fire extinguisher which uses VFX graph to produce the foam effect and thus cannot detect collisions.
Example in Demo Scene: Interact->RayExtinguisher extinguishes one cube in the back after the demo scene has played for a while.
How to Implement:
- You can extinguish the flame also by raycasting if you don’t want to use particle systems which are more expensive for computational power.
- To do this add a “Raycast extinguish” or “Sphere extinguish” component to your game object and adjust the parameters (explanations in tooltips). Sphere does not care if there are objects in front.
- After this the extinguishing should happen automatically if ray hits a collider or trigger which is in the flammable object or a child of flammable object.
- You can also call CastRayCastExtinguish() from outside of the component and set Repeating Raycast to false, if you want to raycast only on the specific moments.