---
description: A quick guide for setting up projectile HitEffects.
---

# Projectile HitEffects (Visual Effects)

### Difficulty: 1/10 <img src="https://1229800202-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQAkTlyeVttU3CJdmYk%2F-MfzOs8r_UzTe7WhP3Tc%2F-MfzUfw94jUTyreywn9u%2Fdifficulty_1.png?alt=media&#x26;token=feabeb3d-303c-456f-81cc-d8b65fefeacd" alt="" data-size="original">&#x20;

A projectile's HitEffects are the visual effects that play upon a projectile impacting an object or wall. They can be changed or set as desired. The easiest way to set up HitEffects is to copy the vfx object from an existing gun in the vanilla game, though it is possible to assign your own custom vfx object if you know how to make one.

## Basic Variables

A projectile's hitEffects can be accessed easily via `projectile.hitEffects`. Via this method, you can adjust the following variables, and more;

```csharp
projectile.hitEffects.alwaysUseMidair
projectile.hitEffects.midairInheritsFlip
projectile.hitEffects.midairInheritsRotation
```

`alwaysUseMidair` determines whether or not a projectile will attempt to use its mid-air effect upon impacting anything. Usually, the midair effect will only play if the projectile reaches the end of its range mid-flight, however, if this variable is set to true the projectile will always use its mid-air effects.

`midairInheritsFlip` determines whether the midair vfx will flip along the horizontal axis to match its base projectile. If this is set to true, projectiles fired to the left will have their midair effects flipped to face the left. This is only noticeable on mid-air effects that are notably directional.

`midairInheritsRotation` determines whether the midair vfx will rotate to match the rotation of its base projectile. If this is set to true, projectiles fired at (for example)  a 90-degree angle will have their vfx rotated by 90 degrees. This is only noticeable on mid-air effects that are notably directional.

## Copying From Existing Guns

The easiest way to set up a projectile's hitEffects is to copy appropriate effects from an existing vanilla gun. Many guns in vanilla actually do this themselves; The Wind-Up Gun, Void Marshal, and Laser Rifle all use the same hitEffects.

To keep things simple, you may choose to always use the midair effect, as explained in the previous section. This will mean you only have to change a couple of variables to make the effects work.

```csharp
projectile.hitEffects.overrideMidairDeathVFX = (PickupObjectDatabase.GetById(89) as Gun).DefaultModule.projectiles[0].hitEffects.overrideMidairDeathVFX;
```

This is an example of copying the midair effects from a base game gun, in this case, the Rogue Special and it's green laser circles. The gun is referenced via its numerical id, in this case, 89. If you want to copy from a different gun's hitEffects, you can change that number to the numerical id of a different gun. A full list of numerical ids can be found [here](https://raw.githubusercontent.com/ModTheGungeon/ETGMod/master/Assembly-CSharp.Base.mm/Content/gungeon_id_map/items.txt).

To copy the other effects of a vanilla gun, you can use similar code;

```csharp
projectile.hitEffects.tileMapHorizontal = (PickupObjectDatabase.GetById(89) as Gun).DefaultModule.projectiles[0].hitEffects.tileMapHorizontal;
projectile.hitEffects.tileMapVertical = (PickupObjectDatabase.GetById(89) as Gun).DefaultModule.projectiles[0].hitEffects.tileMapVertical;
```

To see a list of base game effects that guns use, go to this page:

[https://enterthegungeon.wiki.gg/wiki/Weapon\_Visual\_Effects](https://enterthegungeon.wiki.gg/wiki/Weapon_Visual_Effects)
