# MProjectile

## Overview

The projectile component allows the Animal Controller to throw projectiles using the Damaging system. It can be fired by itself, or it can be fired by a Thrower component.

When is fired by a Thrower component, use the method Prepare() to transfer all the properties from the thrower.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F7ycm7fwU5D9djkNv38ts%2Fimage.png?alt=media&#x26;token=c2dd3d73-9614-4b09-ad45-c19adf770633" alt=""><figcaption></figcaption></figure>

## General

It uses the same properties as the [**MDamager General Tab**](https://malbersanimations.gitbook.io/animal-controller/secondary-components/mdamager/..#general)

## **Projectile Properties**

### Life

Amount of seconds the projectile will be on the air. If the projectile has not touched anything after that time has passed, it will be destroyed.

### Life Impact

Life of the projectile AFTER impact. If the projectile is not destroyed on impact, then wait this amount of time. Set to 0 to ignore it.

### Radius

Radius of the project to cast a ray to find targets better.

### Offsets&#x20;

When the projectile is instantiated for the first time, a local position and rotation offset will be applied to it regarding the thrower. E.g.  When the arrow is instantiated, the position is modified to match better its position on the bow.

### Rotation Behavior

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FQXkku0Xb3nMRPetxfmsa%2Fimage.png?alt=media\&token=49622ecb-aede-477a-9c29-80b54d4875b8)

#### Follow Trajectory

The projectile will follow the Forward Direction vector as rotation. Use this for Arrows, Spears, etc

#### Random

The projectile will rotate randomly. Use the Torque value to rotate faster. Use this for Rocks.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FT4oG5KBpwOp2hajM5m6Z%2Fimage.png?alt=media&#x26;token=b5969eda-4b11-4c55-ab47-d38f66d890a8" alt=""><figcaption></figcaption></figure>

#### Axis

The projectile will rotate around and Axis. Use the Torque value to rotate faster.

### Impact Behavior

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FpF3OEwKsp1mKwDPtjkk1%2Fimage.png?alt=media\&token=0bec9302-26f5-4265-893f-b1b83ce434be)

#### Stick on Surface

The projectile will stick on the contact surface when it hits something. Use this for arrows, spears, etc.

#### Destroy on Impact

The Projectile will be destroyed on impact.

#### Activate RigidBody

If the Projectile has a rigid body attached to it, it will activate the physic on it.

### Rigidbody

Reference to the Projectile Rigidbody

### Collider

Reference to the Projectile Collider

## Damage

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FXOlLdyHhJJd2DHoYbjSu%2Fimage.png?alt=media\&token=81cbf669-6a3e-4cde-862e-21d1d0350fca)

If the Projectile is thrown by a Throwable, the Stat will be set by the Throwable.&#x20;

\[E.g. The Arrow will get the Damage from the Bow, The bullet from the pistol]

### Keep Values

If this option is enabled, then the default values from the[ **Damager Component**](https://malbersanimations.gitbook.io/animal-controller/secondary-components/mdamager/..#damage) will be used.

## Physics

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FHM9g68OKqAe7e65furyd%2Fimage.png?alt=media&#x26;token=af837978-884c-483b-8309-44ac6feba7e6" alt=""><figcaption></figcaption></figure>

### Gravity

Gravity applied to the projectile. If gravity is zero, the projectile will go straight. If the projectile is thrown from a Projectile Thrower, then it will inherit the gravity from it.

### Push Multiplier

Multiplier of the force to apply to the object the projectile impacts.

### React

The Damager receiver will apply its default Animal Reaction

### Custom Reaction

You can set your own custom reaction here.

### Interact

If the Damage Receiver has any [**Interactable** ](https://malbersanimations.gitbook.io/animal-controller/global-components/interactable)component it interact with it sending the InteractorID  value.

### InteractorID

Index to send to the Interactable

### Hit Effect

This Gameobject will be enabled on impact. If it's a Prefab, it will be instantiated.

### Animator Stop Time

Time the Animator will be stopped. If it's zero, stopping the animator is ignored.

### Animator Speed

Value of the Animator Speed when it's stopped

### Animator

If there's an Animator Controller, it will be stopped

## Events

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FRwu3eW1SPRPzRhQEBkm5%2Fimage.png?alt=media&#x26;token=c36080a0-55ce-49e3-8c0b-7e63f6c206a6" alt=""><figcaption></figcaption></figure>

### On Hit

Invoked when the projectile hits a damager

### On Hit Position

Invoked when the projectile hits a damager. It returns the Hit Point of the Damager receiver

### On Hit Interactable

Invoked when the Damager receiver has an Interactable attached.

### On Profile Changed

Invoked when the damage profile changes

### On Fire

Invoked when the projectile is fired
