Grenade

Grenades are Trajectory Objects that can destroy themselves after they collide with an object or a set amount of time. They are thrown by the ThrowableItem component and can explode in the character’s hand if they aren’t thrown fast enough.

Setup

A new grenade can be created by performing the following:

  1. Open the Object Manager and create a new object of type Grenade.
  2. A Capsule Collider will be added to the shell by the Object Manager. A Sphere Collider can also be used if the shell is more spherical.
  3. Adjust the Grenade values to match the type of grenade. In most cases only the Spawned Objects On Destruction value will need to be adjusted.
  4. Assign the prefab to the Throwable Item that should throw it. This is assigned to the Thrown Object field under the Throw foldout:

Inspected Fields

Sticky Layers

The layers that the object can stick to.

Destroy On Collision

Should the grenade be destroyed when it colliders with another object? Most grenades will have this option set to false.

Destruction Delay

The amount of time after a collision that the object should be destroyed.

Spawned Objects On Destruction

The objects which should spawn when the object is destroyed. Each element within this array has the following options:

  • Object: the object that should be spawned
  • Probability: the likelihood that the object will be spawned (0 – 1). A higher value means it is more likely to be spawned.
  • Random Spin: should a random spin be applied to the object after it has spawned?
Lifespan

The length of time before the grenade destructs.

Pin

A reference to the pin that is removed before the character throws the object (can be null).