Example Use Case: You have a flamethrower which uses a VFX graph to produce the flames and thus cannot interact with objects. You want the flamethrower to be able to ignite objects.
Example in Demo Scene: Interact->RayIgniter can be enabled and it will ignite the oil instead of the “Fire” gameobject.
How to implement:
- You can ignite the flame also by raycasting/sphere if you don’t want to use particle systems which are more expensive for computational power.
- To do this add a “Raycast ignite” or “Raycast sphere” 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 igniting 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 CastRayCastIgnite() from outside of the component and set Repeating Raycast to false, if you want to raycast only on the specific moments.