BounceProjModifier

BounceProjModifier is the basic component that causes projectiles to ricochet upon hitting obstacles. It is intended to be applied to projectiles.

Both player projectiles and enemy projectiles use this component to handle their ricochets.

Public Variables

Name

Type

Notes

Default Value

numberOfBounces

int

Controls how many times the projectile is allowed to ricochet.

1

chanceToDieOnBounce

float

Set to a number between 0 and 1, where 0 is 0% and 1 is 100%. Adds a percentage chance for the projectile to, in fact, not bounce upon hitting an obstacle even when the component is present and not all of it's bounces have been used up.

0f

percentVelocityToLoseOnBounce

float

Set to a number between 0 and 1, where 0 is 0% and 1 is 100%. Upon bouncing, the projectile loses speed equal to the specified percentage of it's original velocity.

0f

damageMultiplierOnBounce

float

The projectile's damage is multiplied by this value upon ricocheting.

1f

usesAdditionalScreenShake

bool

Determines whether or not the projectile will trigger the screenshake effect stored in 'additionalScreenShake' upon ricochet.

false

additionalScreenShake

ScreenShakeSettings

Parameters for the screenshake effect that will be triggered upon bounce if 'usesAdditionalScreenShake' is set to true.

null

useLayerLimit

bool

unknown

false

layerLimit

CollisionLayer

unknown

PlayerHitBox

ExplodeOnEnemyBounce

bool

If the parent projectile has an ExplosiveModifier component, and this variable is set to true, then projectiles will not ricochet off enemies and will instead explode on them. Does nothing if the projectile does not have an ExplosiveModifier component.

false

removeBulletScriptControl

bool

If the parent projectile is a part of a Bullet Script and this variable is set to true, then the bullet script will cease to control the projectile's motion after a ricochet.

true

suppressHitEffectsOnBounce

bool

If set to true, then the projectile will not trigger any of it's regular impact visual effects upon bouncing.

false

onlyBounceOffTiles

bool

If set to true, then the projectile will not ricochet off of enemies or other objects, only bouncing off walls.

false

bouncesTrackEnemies

bool

If set to true, then instead of projectiles bouncing along a logical vector from their impact direction, they will instead bounce towards the nearest AIActor in a radius determined by 'bounceTrackRadius'.

false

bounceTrackRadius

float

Determines the radius within which 'smart' bounces can target enemies if 'bouncesTrackEnemies' is true.

5f

TrackEnemyChance

float

Set to a number between 0 and 1, where 0 is 0% and 1 is 100%. Determines the chance for projectiles to 'smart' bounce towards the nearest AIActor if bounceTrackRadius is true. (Eg: if set to 0.5f, projectiles will only have a 50% chance to target the nearest enemy).

1f

Private Variables

Name

Type

Notes

m_lastSmartBounceTarget

AIActor

Contains a reference to the last AIActor the projectile 'smart' bounced towards. Used to prevent the projectile from smart bouncing towards the same Actor twice in a row.

m_cachedNumberOfBounces

int

Stores the amount of bounces the projectile has left.

m_lastBouncePos

Vector2

Stores the position at which the projectile's most recent ricochet occurred.

Actions and Funcs

Name

Arguments

Call Condition

OnBounce

None

Called when the projectile ricochets.

OnBounceContext

BounceProjModifier (The projectile's bounce component)

SpeculativeRigidbody (The object the projectile is bouncing off. Can be null if the projectile is bouncing off something that doesn't have a rigidbody component, such as a wall)

Called when the projectile ricochets. Provides more contextual variables than OnBounce.

Last updated