This component will let you setup your weapon so that it auto aims at targets on the specified layer mask, within the specified radius, and with a line of sight. When a target is found, the weapon will swap its default aim mode to Script, until no more target is found. It's important to have a base aim mode to revert to, such as PrimaryMovement
More...
This component will let you setup your weapon so that it auto aims at targets on the specified layer mask, within the specified radius, and with a line of sight. When a target is found, the weapon will swap its default aim mode to Script, until no more target is found. It's important to have a base aim mode to revert to, such as PrimaryMovement
◆ AimOrigins
the possible origins to consider for the aim
◆ DetermineRaycastOrigin()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.DetermineRaycastOrigin |
( |
| ) |
|
|
protectedvirtual |
A method used to compute the origin of the detection casts
◆ FirstTargetFound()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.FirstTargetFound |
( |
| ) |
|
|
protectedvirtual |
When a new target is found and we didn't have one already, we play a dedicated feedback
◆ HandleMoveCameraTarget()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.HandleMoveCameraTarget |
( |
| ) |
|
|
protectedvirtual |
Moves the camera target towards the auto aim target if needed
◆ HandleTarget()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.HandleTarget |
( |
| ) |
|
|
protectedvirtual |
Sets aim if needed, otherwise reverts to the previous aim control mode
◆ HandleTargetChange()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.HandleTargetChange |
( |
| ) |
|
|
protectedvirtual |
Checks for target changes and triggers the appropriate methods if needed
◆ HandleToggleIgnoreSlopeRotation()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.HandleToggleIgnoreSlopeRotation |
( |
| ) |
|
|
protectedvirtual |
◆ Initialization()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.Initialization |
( |
| ) |
|
|
protectedvirtual |
◆ NewTargetFound()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.NewTargetFound |
( |
| ) |
|
|
protectedvirtual |
When a new target is found, and we previously had another, we play a dedicated feedback
◆ NoMoreTargets()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.NoMoreTargets |
( |
| ) |
|
|
protectedvirtual |
When no more targets are found, and we just lost one, we play a dedicated feedback
◆ OnDisable()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.OnDisable |
( |
| ) |
|
|
protectedvirtual |
On Disable, we hide our aim marker if needed
◆ OnDrawGizmos()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.OnDrawGizmos |
( |
| ) |
|
|
protectedvirtual |
Draws a sphere around the weapon to show its auto aim radius
◆ ScanForTargets()
virtual bool MoreMountains.CorgiEngine.WeaponAutoAim.ScanForTargets |
( |
| ) |
|
|
protectedvirtual |
This method should define how the scan for targets is performed
- Returns
◆ ScanIfNeeded()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.ScanIfNeeded |
( |
| ) |
|
|
protectedvirtual |
◆ SetAim()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.SetAim |
( |
| ) |
|
|
protectedvirtual |
Sends aim coordinates to the weapon aim component
◆ Start()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.Start |
( |
| ) |
|
|
protectedvirtual |
On Awake we initialize our component
◆ Update()
virtual void MoreMountains.CorgiEngine.WeaponAutoAim.Update |
( |
| ) |
|
|
protectedvirtual |
On Update, we setup our ray origin, scan periodically and set aim if needed
◆ _aimDirection
Vector3 MoreMountains.CorgiEngine.WeaponAutoAim._aimDirection |
|
protected |
◆ _aimMarker
AimMarker MoreMountains.CorgiEngine.WeaponAutoAim._aimMarker |
|
protected |
◆ _boxcastDirection
Vector3 MoreMountains.CorgiEngine.WeaponAutoAim._boxcastDirection |
|
protected |
◆ _character
Character MoreMountains.CorgiEngine.WeaponAutoAim._character |
|
protected |
◆ _contactFilter
ContactFilter2D MoreMountains.CorgiEngine.WeaponAutoAim._contactFilter |
|
protected |
◆ _detectionColliders
List<Collider2D> MoreMountains.CorgiEngine.WeaponAutoAim._detectionColliders |
|
protected |
◆ _facingDirection
Vector2 MoreMountains.CorgiEngine.WeaponAutoAim._facingDirection |
|
protected |
◆ _initialized
bool MoreMountains.CorgiEngine.WeaponAutoAim._initialized = false |
|
protected |
◆ _lastScanTimestamp
float MoreMountains.CorgiEngine.WeaponAutoAim._lastScanTimestamp = 0f |
|
protected |
◆ _newCamTargetDirection
Vector3 MoreMountains.CorgiEngine.WeaponAutoAim._newCamTargetDirection |
|
protected |
◆ _newCamTargetPosition
Vector3 MoreMountains.CorgiEngine.WeaponAutoAim._newCamTargetPosition |
|
protected |
◆ _originalAimControl
◆ _originalMoveCameraTarget
bool MoreMountains.CorgiEngine.WeaponAutoAim._originalMoveCameraTarget |
|
protected |
◆ _originalRotationMode
◆ _potentialHit
Collider2D MoreMountains.CorgiEngine.WeaponAutoAim._potentialHit |
|
protected |
◆ _raycastOrigin
Vector3 MoreMountains.CorgiEngine.WeaponAutoAim._raycastOrigin |
|
protected |
◆ _targetLastFrame
Transform MoreMountains.CorgiEngine.WeaponAutoAim._targetLastFrame |
|
protected |
◆ _weapon
Weapon MoreMountains.CorgiEngine.WeaponAutoAim._weapon |
|
protected |
◆ _weaponAim
WeaponAim MoreMountains.CorgiEngine.WeaponAutoAim._weaponAim |
|
protected |
◆ AimMarkerPrefab
AimMarker MoreMountains.CorgiEngine.WeaponAutoAim.AimMarkerPrefab |
An AimMarker prefab to use to show where this auto aim weapon is aiming.
◆ AimOrigin
the object to consider as the origin of the aim
◆ CameraTargetDistance
float MoreMountains.CorgiEngine.WeaponAutoAim.CameraTargetDistance = 0.5f |
the normalized distance (between 0 and 1) at which the camera target should be, on a line going from the weapon owner (0) to the auto aim target (1)
◆ CameraTargetMaxDistance
float MoreMountains.CorgiEngine.WeaponAutoAim.CameraTargetMaxDistance = 10f |
the maximum distance from the weapon owner at which the camera target can be
◆ CameraTargetSpeed
float MoreMountains.CorgiEngine.WeaponAutoAim.CameraTargetSpeed = 5f |
the speed at which to move the camera target
◆ DetectionOriginOffset
Vector3 MoreMountains.CorgiEngine.WeaponAutoAim.DetectionOriginOffset = Vector3.zero |
an offset to apply to the weapon's position for scan
◆ DetectTriggers
bool MoreMountains.CorgiEngine.WeaponAutoAim.DetectTriggers = false |
whether or not auto aim should detect trigger colliders
◆ DrawDebugRadius
bool MoreMountains.CorgiEngine.WeaponAutoAim.DrawDebugRadius = true |
whether or not to draw a debug sphere around the weapon to show its aim radius
◆ DurationBetweenScans
float MoreMountains.CorgiEngine.WeaponAutoAim.DurationBetweenScans = 1f |
the duration (in seconds) between 2 scans for targets
◆ FirstTargetFoundFeedback
MMFeedbacks MoreMountains.CorgiEngine.WeaponAutoAim.FirstTargetFoundFeedback |
A feedback to play when a target is found and we didn't have one already.
◆ LineOfFireBoxcastSize
Vector2 MoreMountains.CorgiEngine.WeaponAutoAim.LineOfFireBoxcastSize = new Vector2(0.1f, 0.1f) |
the size of the boxcast that will be performed to verify line of fire
◆ MoveCameraTarget
bool MoreMountains.CorgiEngine.WeaponAutoAim.MoveCameraTarget = true |
whether or not this component should take control of the camera target when a camera is found
◆ NewTargetFoundFeedback
MMFeedbacks MoreMountains.CorgiEngine.WeaponAutoAim.NewTargetFoundFeedback |
a feedback to play when we already had a target and just found a new one
◆ NoMoreTargetsFeedback
MMFeedbacks MoreMountains.CorgiEngine.WeaponAutoAim.NoMoreTargetsFeedback |
a feedback to play when no more targets are found, and we just lost our last target
◆ ObstacleMask
the layermask on which to look for obstacles
◆ RotationMode
the rotation mode to apply when a target is found
◆ ScanRadius
float MoreMountains.CorgiEngine.WeaponAutoAim.ScanRadius = 15f |
the radius (in units) around the character within which to search for targets
◆ Target
Transform MoreMountains.CorgiEngine.WeaponAutoAim.Target |
the current target of the auto aim module
◆ TargetsMask
the layermask on which to look for aim targets
◆ ToggleIgnoreSlopeRotation
bool MoreMountains.CorgiEngine.WeaponAutoAim.ToggleIgnoreSlopeRotation = false |
if this is true, the target WeaponAim's IgnoreSlopeRotation will be turned on/off depending on whether or not we have a target
The documentation for this class was generated from the following file: