🏹Aim
1.4.2.d+
Last updated
1.4.2.d+
Last updated
The Aim Component is used to cast a ray from the Aim Origin gameobject to the center of the camera or an assigned Target.
It is commonly used to Aim Weapons, do a Head Look At, or for the Strafing logic.
This component needs to have an Aim Origin reference.
Enable/Disable the Aim Logic. Use this to avoid doing raycasting while the aim component is not used.
Where the Aim Logic will take place, on the Fixed or Late Update cycle.
It's used for planning whether your Camera Rig can be on the Left or Right side of your character when aiming.
It uses the On Aim event to send the value -1 if the camera is on the Left side, 1 if is on the Right side, or 0 if the Amining logic is not Active.
The Transform object used to determine the origin position of the Aim Ray. Usually the head of the character.
Which layers the Aim Ray will interact with
Will the Aim Ray interact with triggers?
If this value is greater than zero, the Aim Ray will be using SphereCast instead of RayCast.
Increase the precision of the Raycasting logic.
Since I'm using the NonAlloc Version to make faster raycasting, this doesn't always create accurate Hits when the ray touches more than one object. Increasing the hits increases the accuracy.
Lerp value for changing the Ray cast hit position. Lower values, smooth Aiming
Replaces the Aim Logic from Aiming with the Camera to Aiming towards a target.
The Aim Target will use a camera to cast a ray from the camera's position
Reference for the Main Camera
When using a Camera as the Ray Origin. An offset will be added to the center of the screen where the Ray will be cast.
Extra Transform Reference to Ignore for the Aim Logic. This is used for example with the Rider when is mounting the horse and the Weapon is Aiming. The Horse is set as the extra transform so Aim Ray does not hit the horse gameobject and its children.
It moves the Transform assigned to this parameter to the Hit Position. It is used to create an assistance to see where the Aim Ray Ends. It also hides this transform when the Aim is not Active.
Invoked when the Aim Logic is Enabled/Disabled
Invoked when an object is hit by the Aim Ray.
Invoke the Transform the Aim Ray touches.
Invoked true or false when a new Target is assigned
Invoked when the Target on the Aim component is removed
Invoked when a new Target object is assigned
Invoke the current Screen position.
Invoke -1 if the Main Camera or Target is on the Left or 1 if it's on the Right side of the character. Useful to change states on the Camera Rig System