Next: , Previous: , Up: Combat   [Contents][Index]


6.3 Bullet

Component: Bullet

This component allows for physics-based projectiles to be used (as long as they deal damage on contact - not for bouncy grenades!) Sends the ’ModifyHealth’ message with -damage to the object that is hit Sends the ’AttackedBy’ message with a reference to the owner object or null if none assigned. The ’Modern Gun’ component sets this automatically for use by AI.

To use this for a standard bullet, simply add it to an object and adjust the settings. Set the Rigidbody properties you want, and remove colliders. This component does not use regular colliders but instead checks to see if it has passed through something, and if it has, it ’explodes’ at the point of impact. By adding a prefab to ’Bullet Splash’ you can create explosive projectiles, bullet hole decals, etc.

Important - Must be populated

Field of Bullet: LayerMask rayMask

What layers can this projectile collide with?

Projectile Settings

Field of Bullet: bool damageRoot

Should we send the damage message to the root object? If false, it will be sent to the object with the collider instead.

Default value: true

Field of Bullet: List<MessageManager.ManagedMessage> messages

Messages to be sent to the object we hit

Default value: new List<MessageManager.ManagedMessage>()

Important - Must be populated

Field of Bullet: LayerMask rayMask

What layers can this projectile collide with?

Projectile Settings

Field of Bullet: bool damageRoot

Should we send the damage message to the root object? If false, it will be sent to the object with the collider instead.

Default value: true

Field of Bullet: List<MessageManager.ManagedMessage> messages

Messages to be sent to the object we hit

Default value: new List<MessageManager.ManagedMessage>()


Next: , Previous: , Up: Combat   [Contents][Index]