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


2.3 Hitscan Module

Component: HitscanModule

This component should be placed on an empty object representing an AI. The object should have a 3D model of a unit parented to it. We also recommend adding a NavModule or similar, so it can get around, and some sort of AI ’brain’ such as a Guard or Minion Module. Make sure to set up all settings such as ray mask (so that it can’t shoot or hit through walls)

Field of HitscanModule: float tgtYOffset

How far above or below the target object’s origin should we look for the ’center’ of the object?

Default value: .5f

Field of HitscanModule: float headingConeRadius

How wide should the target cone be? We must be facing within this percentage of a 180 degree FOV of the target position + Tgt Y Offset to apply damage

Default value: .35f

Combat Settings

Recommended Field of HitscanModule: string attackAnimationTrigger

Trigger in the Animator Controller on this object to be sent when the AI attacks

Field of HitscanModule: float cooldownDuration

Cooldown duration

Default value: 1.0f

Field of HitscanModule: float damageDelay

How long do we wait after starting the attack animation to actually apply the damage?

Default value: .5f

Field of HitscanModule: float attackDamage

Damage per hit

Default value: 10.0f

Field of HitscanModule: float stunTime

If greater than 0, will stun it’s target for this duration in seconds

Default value: 0

Required Field of HitscanModule: GameObject damageRayOrigin

An object representing a raycast where the damage starts. Should be an empty transform slightly in front of the character. Raycasts from this point to prevent damage through walls etc.

Field of HitscanModule: float hitscanRange

Range of the attack

Default value: 2.3f

Field of HitscanModule: LayerMask damageObstructionMask

What collision layers can block our attacks & vision?

Field of HitscanModule: float huntingTimeOut

How long do we keep hunting our target after we can’t see them anymore?

Default value: 10

Message Senders

Field of HitscanModule: List<MessageManager.ManagedMessage> attackMessages

Messages to send when damage is dealt

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

Field of HitscanModule: List<MessageManager.ManagedMessage> messagesToVictim

Messages sent to the victim when damage is dealt

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

Field of HitscanModule: List<MessageManager.ManagedMessage> missMessages

Messages sent if we miss the target

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

Audio Settings

Field of HitscanModule: bool debug

Send messages to the console?

Default value: false

Message on HitscanModule: TargetNearest (string)

Targets the nearest object of a given tag

Argument: The tag of the object we wish to target

Message on HitscanModule: ClearTarget ()

Causes the Hitscan Module to stop targeting anything.

Field of HitscanModule: float tgtYOffset

How far above or below the target object’s origin should we look for the ’center’ of the object?

Default value: .5f

Field of HitscanModule: float headingConeRadius

How wide should the target cone be? We must be facing within this percentage of a 180 degree FOV of the target position + Tgt Y Offset to apply damage

Default value: .35f

Combat Settings

Recommended Field of HitscanModule: string attackAnimationTrigger

Trigger in the Animator Controller on this object to be sent when the AI attacks

Field of HitscanModule: float cooldownDuration

Cooldown duration

Default value: 1.0f

Field of HitscanModule: float damageDelay

How long do we wait after starting the attack animation to actually apply the damage?

Default value: .5f

Field of HitscanModule: float attackDamage

Damage per hit

Default value: 10.0f

Field of HitscanModule: float stunTime

If greater than 0, will stun it’s target for this duration in seconds

Default value: 0

Required Field of HitscanModule: GameObject damageRayOrigin

An object representing a raycast where the damage starts. Should be an empty transform slightly in front of the character. Raycasts from this point to prevent damage through walls etc.

Field of HitscanModule: float hitscanRange

Range of the attack

Default value: 2.3f

Field of HitscanModule: LayerMask damageObstructionMask

What collision layers can block our attacks & vision?

Field of HitscanModule: float huntingTimeOut

How long do we keep hunting our target after we can’t see them anymore?

Default value: 10

Message Senders

Field of HitscanModule: List<MessageManager.ManagedMessage> attackMessages

Messages to send when damage is dealt

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

Field of HitscanModule: List<MessageManager.ManagedMessage> messagesToVictim

Messages sent to the victim when damage is dealt

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

Field of HitscanModule: List<MessageManager.ManagedMessage> missMessages

Messages sent if we miss the target

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

Audio Settings

Field of HitscanModule: bool debug

Send messages to the console?

Default value: false

Message on HitscanModule: TargetNearest (string)

Targets the nearest object of a given tag

Argument: The tag of the object we wish to target

Message on HitscanModule: ClearTarget ()

Causes the Hitscan Module to stop targeting anything.


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