IProjectileFactoryCollisionReceiver

v1.1

The IProjectileFactoryCollisionReceiver interface can be used to ensure that collisions executed by non-physics based methods such as ProjectileRaycastHitDetector or InstantHitForward properly know they've been hit.

Each of the main demo projectiles has various ways of colliding, to demonstrate the various behaviors that can be used. For objects such as the cubes and spheres in the Juicy Actions Integration, these are "simple" objects β€” they don't have an Actor component on them or anything like the enemy characters do.

They utilize the ActionOnPhysicsEvent component, which handles both Trigger and Collider, but those won't fire when the collision from the projectile doesn't use triggers or colliders via physics. We can use this interface to pass information along, and handle it accordingly, i.e. calling the proper ActionExecutor.

This interface has one method:

When ProjectileRaycastHitDetector or InstantHitForward have the optional sendCollisionEnterToCollider, then any object that was detected will have this method called if the interface is present.

Projectile Collision Message

The struct ProjectileCollisionMessage contains data about the collision which an be used similar to a normal collision.

Example Implementation

In the Juicy Actions Integration for Projectile Factory, the cubes and spheres are basic objects without any fancy actor type class on them. Since each demo projectile has differnet collision behaviors, we want the sphere and cube to react properly.

In this class, which ships with the integration package, we call HandleTriggerEnter(null) when the OnProectileFactoryCollisionEnter event is received. This calls the OnEnter actions.

Note that to make this work the projectiles must have the option enabled to send this data, and the ActionOnCollision, ActionOnTrigger, or ActionOnPhysicsEvent components must allow null colliders.

In your custom handling, you can make use of the ProjectileCollisionMessage data. This example does not.

With those set, our sphere and cube objects now have Juicy Actions when they're hit by any projectile.

Last updated