# Controller

*Assets/FORGE3D/DamageFX/Scripts/DamageFX.cs*

In order to control the Damage FX Shader, an instance of the script should be present on each Damage FX Object. The script component handles the data processing for impact spots and fades the heat values over time.

![](/files/-MAuahpT1aSHZhBa1h0d)

Use **DamageFX.Hit()** method of the script to add new impacts to the surface of the mesh as shown below:

![](/files/-MAuajMtCroj_nXR65c9)

Here is the simple code snippet that will add the damage point to the Damage FX Object under the mouse cursor on left mouse click:

```csharp
public float HitRadius = 0.1f; 
public float Dirt = 1f; 
public float Burn = 1f; 
public float Heat = 1f; 
public float Clip = 0.7f;
 
private RaycastHit _hitInfo;
 
private void Update()
{
 
  if (!Input.GetMouseButtonDown(0)) return;
     
  var screenRay = Camera.main.ScreenPointToRay(Input.mousePosition);
   
  if (!Physics.Raycast(screenRay, out _hitInfo, Mathf.Infinity)) return;
   
  var dfx = _hitInfo.collider.GetComponent<DamageFX>();
   
  if (dfx != null) dfx.Hit(dfx.transform.InverseTransformPoint(_hitInfo.point), HitRadius, Dirt, Burn, Heat, Clip);
   
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forge3d.com/damage-fx/controller.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
