Add this component to a Weapon and you'll be able to aim it (meaning you'll rotate it) Supported control modes are mouse, primary movement (you aim wherever you direct your character) and secondary movement (using a secondary axis, separate from the movement).
More...
|
| AimControls | AimControl = AimControls.SecondaryMovement |
| | the aim control mode of choice (off : no control, primary movement (typically your left stick), secondary (right stick), mouse, script : when you want a script to drive your aim (typically for AI, but not only) More...
|
| |
| RotationModes | RotationMode = RotationModes.Free |
| | the rotation mode More...
|
| |
| float | WeaponRotationSpeed = 1f |
| | the the speed at which the weapon reaches its new position. Set it to zero if you want movement to directly follow input More...
|
| |
| bool | InstantFlip = false |
| | if this is true, a flip will be instant, regardless of the weapon rotation speed More...
|
| |
| bool | PreventAimWhileWeaponIsInUse = false |
| | if this is true, you won't be able to aim this weapon's aim while it's in use More...
|
| |
| float | MinimumAngle = -180f |
| | the minimum angle at which the weapon's rotation will be clamped More...
|
| |
| float | MaximumAngle = 180f |
| | the maximum angle at which the weapon's rotation will be clamped More...
|
| |
| bool | IgnoreSlopeRotation = false |
| | if this is true, slope rotation will be ignored More...
|
| |
| bool | IgnoreDownWhenGrounded = false |
| | if this is true, aiming down won't impact this WeaponAim, similar to how Contra games do it More...
|
| |
| GameObject | Reticle |
| | the gameobject to display as the aim's reticle/crosshair. Leave it blank if you don't want a reticle More...
|
| |
| bool | DisplayReticle = true |
| | if set to false, the reticle won't be added and displayed More...
|
| |
| float | ReticleDistance |
| | the distance at which the reticle will be from the weapon More...
|
| |
| float | ReticleZPosition |
| | the z position of the reticle More...
|
| |
| bool | ReticleAtMousePosition |
| | if set to true, the reticle will be placed at the mouse's position (like a pointer) More...
|
| |
| bool | RotateReticle = false |
| | if set to true, the reticle will rotate on itself to reflect the weapon's rotation. If not it'll remain stable. More...
|
| |
| bool | ReplaceMousePointer = true |
| | if set to true, the reticle will replace the mouse pointer More...
|
| |
| bool | DisableReticleOnDeath = true |
| | whether or not the reticle should be hidden when the character is dead More...
|
| |
Add this component to a Weapon and you'll be able to aim it (meaning you'll rotate it) Supported control modes are mouse, primary movement (you aim wherever you direct your character) and secondary movement (using a secondary axis, separate from the movement).
◆ AimControls
the list of possible control modes
| Enumerator |
|---|
| Off | |
| PrimaryMovement | |
| SecondaryMovement | |
| Mouse | |
| Script | |
◆ RotationModes
the list of possible rotation modes
| Enumerator |
|---|
| Free | |
| Strict4Directions | |
| Strict8Directions | |
◆ AddAdditionalAngle()
| virtual void MoreMountains.CorgiEngine.WeaponAim.AddAdditionalAngle |
( |
float |
addedAngle | ) |
|
|
virtual |
◆ DetermineWeaponRotation()
| virtual void MoreMountains.CorgiEngine.WeaponAim.DetermineWeaponRotation |
( |
| ) |
|
|
protectedvirtual |
Determines the weapon rotation based on the current aim direction
◆ GetCurrentAim()
| virtual void MoreMountains.CorgiEngine.WeaponAim.GetCurrentAim |
( |
| ) |
|
|
protectedvirtual |
Computes the current aim direction
◆ HideReticle()
| virtual void MoreMountains.CorgiEngine.WeaponAim.HideReticle |
( |
| ) |
|
|
protectedvirtual |
Handles the hiding of the reticle and cursor
◆ Initialization()
| virtual void MoreMountains.CorgiEngine.WeaponAim.Initialization |
( |
| ) |
|
|
protectedvirtual |
Grabs the weapon component, initializes the angle values
◆ InitializeReticle()
| virtual void MoreMountains.CorgiEngine.WeaponAim.InitializeReticle |
( |
| ) |
|
|
protectedvirtual |
If a reticle has been set, instantiates the reticle and positions it
◆ LateUpdate()
| virtual void MoreMountains.CorgiEngine.WeaponAim.LateUpdate |
( |
| ) |
|
|
protectedvirtual |
Every frame, we compute the aim direction and rotate the weapon accordingly
◆ MoveReticle()
| virtual void MoreMountains.CorgiEngine.WeaponAim.MoveReticle |
( |
| ) |
|
|
protectedvirtual |
Every frame, moves the reticle if it's been told to follow the pointer
◆ ResetAdditionalAngle()
| virtual void MoreMountains.CorgiEngine.WeaponAim.ResetAdditionalAngle |
( |
| ) |
|
|
virtual |
◆ ResetCurrentAimMultiplier()
| virtual void MoreMountains.CorgiEngine.WeaponAim.ResetCurrentAimMultiplier |
( |
| ) |
|
|
protectedvirtual |
Resets the current aim multiplier at the end of the frame
◆ RotateWeapon()
| virtual void MoreMountains.CorgiEngine.WeaponAim.RotateWeapon |
( |
Quaternion |
newRotation | ) |
|
|
protectedvirtual |
Rotates the weapon, optionnally applying a lerp to it.
- Parameters
-
◆ SetCurrentAim()
| virtual void MoreMountains.CorgiEngine.WeaponAim.SetCurrentAim |
( |
Vector3 |
newAim | ) |
|
|
virtual |
Aims the weapon towards a new point
- Parameters
-
◆ Start()
| virtual void MoreMountains.CorgiEngine.WeaponAim.Start |
( |
| ) |
|
|
protectedvirtual |
On Start(), we trigger the initialization
◆ _additionalAngle
| float MoreMountains.CorgiEngine.WeaponAim._additionalAngle |
|
protected |
◆ _characterGravity
◆ _controller
◆ _currentAim
| Vector3 MoreMountains.CorgiEngine.WeaponAim._currentAim = Vector3.zero |
|
protected |
◆ _direction
| Vector3 MoreMountains.CorgiEngine.WeaponAim._direction |
|
protected |
◆ _initialRotation
| Quaternion MoreMountains.CorgiEngine.WeaponAim._initialRotation |
|
protected |
◆ _lookRotation
| Quaternion MoreMountains.CorgiEngine.WeaponAim._lookRotation |
|
protected |
◆ _mainCamera
| Camera MoreMountains.CorgiEngine.WeaponAim._mainCamera |
|
protected |
◆ _mousePosition
| Vector3 MoreMountains.CorgiEngine.WeaponAim._mousePosition |
|
protected |
◆ _possibleAngleValues
| float [] MoreMountains.CorgiEngine.WeaponAim._possibleAngleValues |
|
protected |
◆ _regularHorizontalAimMultiplier
| Vector2 MoreMountains.CorgiEngine.WeaponAim._regularHorizontalAimMultiplier = new Vector2(1f, 1f) |
|
protected |
◆ _reticle
| GameObject MoreMountains.CorgiEngine.WeaponAim._reticle |
|
protected |
◆ _reticlePosition
| Vector3 MoreMountains.CorgiEngine.WeaponAim._reticlePosition |
|
protected |
◆ _weapon
| Weapon MoreMountains.CorgiEngine.WeaponAim._weapon |
|
protected |
◆ _weapons
| List<Weapon> MoreMountains.CorgiEngine.WeaponAim._weapons |
|
protected |
◆ AimControl
the aim control mode of choice (off : no control, primary movement (typically your left stick), secondary (right stick), mouse, script : when you want a script to drive your aim (typically for AI, but not only)
◆ DisableReticleOnDeath
| bool MoreMountains.CorgiEngine.WeaponAim.DisableReticleOnDeath = true |
whether or not the reticle should be hidden when the character is dead
◆ DisplayReticle
| bool MoreMountains.CorgiEngine.WeaponAim.DisplayReticle = true |
if set to false, the reticle won't be added and displayed
◆ IgnoreDownWhenGrounded
| bool MoreMountains.CorgiEngine.WeaponAim.IgnoreDownWhenGrounded = false |
if this is true, aiming down won't impact this WeaponAim, similar to how Contra games do it
◆ IgnoreSlopeRotation
| bool MoreMountains.CorgiEngine.WeaponAim.IgnoreSlopeRotation = false |
if this is true, slope rotation will be ignored
◆ InstantFlip
| bool MoreMountains.CorgiEngine.WeaponAim.InstantFlip = false |
if this is true, a flip will be instant, regardless of the weapon rotation speed
◆ MaximumAngle
| float MoreMountains.CorgiEngine.WeaponAim.MaximumAngle = 180f |
the maximum angle at which the weapon's rotation will be clamped
◆ MinimumAngle
| float MoreMountains.CorgiEngine.WeaponAim.MinimumAngle = -180f |
the minimum angle at which the weapon's rotation will be clamped
◆ PreventAimWhileWeaponIsInUse
| bool MoreMountains.CorgiEngine.WeaponAim.PreventAimWhileWeaponIsInUse = false |
if this is true, you won't be able to aim this weapon's aim while it's in use
◆ ReplaceMousePointer
| bool MoreMountains.CorgiEngine.WeaponAim.ReplaceMousePointer = true |
if set to true, the reticle will replace the mouse pointer
◆ Reticle
| GameObject MoreMountains.CorgiEngine.WeaponAim.Reticle |
the gameobject to display as the aim's reticle/crosshair. Leave it blank if you don't want a reticle
◆ ReticleAtMousePosition
| bool MoreMountains.CorgiEngine.WeaponAim.ReticleAtMousePosition |
if set to true, the reticle will be placed at the mouse's position (like a pointer)
◆ ReticleDistance
| float MoreMountains.CorgiEngine.WeaponAim.ReticleDistance |
the distance at which the reticle will be from the weapon
◆ ReticleZPosition
| float MoreMountains.CorgiEngine.WeaponAim.ReticleZPosition |
the z position of the reticle
◆ RotateReticle
| bool MoreMountains.CorgiEngine.WeaponAim.RotateReticle = false |
if set to true, the reticle will rotate on itself to reflect the weapon's rotation. If not it'll remain stable.
◆ RotationMode
◆ WasFacingRightLastFrame
| bool MoreMountains.CorgiEngine.WeaponAim.WasFacingRightLastFrame |
|
protected |
◆ WeaponRotationSpeed
| float MoreMountains.CorgiEngine.WeaponAim.WeaponRotationSpeed = 1f |
the the speed at which the weapon reaches its new position. Set it to zero if you want movement to directly follow input
◆ CurrentAimMultiplier
| Vector2 MoreMountains.CorgiEngine.WeaponAim.CurrentAimMultiplier |
|
getset |
◆ CurrentAngle
| float MoreMountains.CorgiEngine.WeaponAim.CurrentAngle |
|
getprotected set |
the current angle the weapon is aiming at
◆ CurrentAngleRelative
| float MoreMountains.CorgiEngine.WeaponAim.CurrentAngleRelative |
|
get |
the current angle the weapon is aiming at, adjusted to compensate for the current orientation of the character
◆ CurrentRotation
| virtual Quaternion MoreMountains.CorgiEngine.WeaponAim.CurrentRotation |
|
get |
the weapon's current rotation
The documentation for this class was generated from the following file:
- Assets/CorgiEngine/Common/Scripts/Agents/Weapons/WeaponAim.cs