Collisions and CollisionEffectsData

Collision Manager

The CollisionManager is a component which sits on the same GameObject as the Rigidbody and captures the collision events, then invokes its own events for the AVC components that require them.

Events

These events are public and free for you to use anyway you should need. Just get a reference to the CollisionManager and then subscribe to the following.

Action<Collision> OnVehicleCollisionEnter

Action<Collision> OnVehicleCollisionExit

Action<Collision> OnVehicleCollisionStay

CollisionEffectsData

The CollisionEffectsData holds the information required for collisions.

Effects ID (optional) - Enter a name for this effect, if you are using a 'Custom' CollisionType, otherwise it can be left blank.

Collision Type - Select the type of collision this asset is for. There currently only options Default and Custom.

Effect Prefab - Assign the prefab that should be spawned when this collision occurs. Two example prefabs are included with AVC.

Required Speed - Set this to the minimum speed you want your vehicle to be moving for this effect to spawn.

Collision Tag

This component is used by AVC for spawning custom effects on collisions, add this to any object you wish to have a custom particle system spawn when hit, enter the required CollisionID, and as long as the CollisionEffectsData for it is added to the vehicles, then this effect will spawn on collision.

Last updated