# Additional Scripts

**Projectile Factory** comes with additional scripts. Some interact with Projectile Factory systems, while others simply help you do cool things. Smaller scripts are discussed briefly on this page, while others have their own subpages with details.

## Face Direction of Motion

Add `FaceDirectionOfMotion.cs` to any object with a Rigidbody that you want to turn to face (z-direction) to the direction of motion. Useful for thigns like arrows that are following a physics trajectory.

## Fade Light

The `FadeLight.cs` script will fade a light out over time. It can automatically start `OnEnable`, which is great for things like a muzzle or impact flash. Otherwise, the `StartFade()` method needs to be called to trigger the effect.

## On Enable Change Size

Sometimes a projectile is bigger than the spawner, and looks odd when instantiated. The `OnEnableChangeSize.cs` component will change the scale of an object over time, starting `OnEnable`. Use this to quickly scale an object up, allowing it to appear more natural when existing a spawner.

## On Enable Fade Material Color

This will fade the color of a material starting `OnEnable`. If you fade the alpha value, you can fade the object into existence over time.

## On Enable Turn Collider On

Sometimes you may want to keep a collider turned off for a period of time. This will allow you to turn on a `Collider` either `OnEnable` or after a specified delay.

## Play Audio Clip On Awake

This simple script will play a random `AudioClip` from a `List` of clips on `Awake`.

## Turn Off Objects On Collision

This was made specifically for the [**integration with Realistic Effects Pack 4**](/magic-pig-games/projectile-factory/3rd-party-particle-integrations-16/kripto289-1/realistic-effects-pack-4.md). It is used to turn off specific objects when a Projectile collides.

## Toggle Lights With Projectile Launch

This component will turn lights on and off, ensuring they turn on when the projectile is launched, and off otherwise.

## Toggle Particles With Projectile Launch

When the **Projectile** is launched, particles will play, otherwise they will stop.

## Trigger Movement On Spawn Point Change

This was made for the integration with [**Sci-Fi Effects by FORGE3D**](/magic-pig-games/projectile-factory/3rd-party-particle-integrations-16/forge3d-1/sci-fi-effects.md), and handles the movement of the turret barrels. It triggers some movement when the spawn point is changed to "this" point, which is how we achieve the barrel motion when the turret fires.


---

# 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://infinitypbr.gitbook.io/magic-pig-games/projectile-factory/projectile-factory-documentation/additional-scripts.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.
