Class AimAt
Implements the functionality of aiming at a target
Assembly: cs.temp.dll.dll
Syntax
public abstract class AimAt : MonoBehaviour
Fields
aimDirection
Declaration
protected AimAt.AimDirection aimDirection
Field Value
The Transform of the agent childobjects that should directly aim at the target
Declaration
protected Transform aimTransform
Field Value
Type |
Description |
Transform |
|
angleLimit
Declaration
protected float angleLimit
Field Value
Declaration
protected Transform[] boneTransforms
Field Value
Type |
Description |
Transform[] |
|
currentLookSpeed
Declaration
protected float currentLookSpeed
Field Value
distanceLimit
Declaration
protected float distanceLimit
Field Value
humanBones
Declaration
protected HumanBone[] humanBones
Field Value
increaseLookSpeedBy
Declaration
protected float increaseLookSpeedBy
Field Value
iterations
Declaration
Field Value
navMeshAgent
Declaration
protected NavMeshAgent navMeshAgent
Field Value
Type |
Description |
NavMeshAgent |
|
Declaration
protected Transform startingTransform
Field Value
Type |
Description |
Transform |
|
targetFollower
The Transform that is acutally looked at and will follow the target smootly
Declaration
protected Transform targetFollower
Field Value
Type |
Description |
Transform |
|
The transform that should be aimed at
Declaration
protected Transform targetTransform
Field Value
Type |
Description |
Transform |
|
Properties
LookSpeed
Declaration
public float LookSpeed { get; set; }
Property Value
ShouldDestroyItself
true if the component should destroy itself, when the aiming stops and the aim is back at the starting position
Declaration
public bool ShouldDestroyItself { get; set; }
Property Value
Weight
Declaration
public float Weight { get; set; }
Property Value
Methods
Declaration
protected void AimAtTarget(Transform bone, Vector3 targetPosition, float weight)
Parameters
Type |
Name |
Description |
Transform |
bone |
|
Vector3 |
targetPosition |
|
Single |
weight |
|
CalculateWhereToLook()
Declaration
protected Vector3 CalculateWhereToLook()
Returns
GetAimDirectionVector()
Declaration
protected Vector3 GetAimDirectionVector()
Returns
GetBoneTransformsFromAnimatior(HumanBodyBones)
Declaration
protected void GetBoneTransformsFromAnimatior(HumanBodyBones aimingTip)
Parameters
Type |
Name |
Description |
HumanBodyBones |
aimingTip |
|
LateUpdate()
Declaration
protected void LateUpdate()
OnDrawGizmos()
Declaration
protected void OnDrawGizmos()
SetBonePreset()
To set up the aiming at a specific body part, a preset of bones and weights and related settings can be selected
Declaration
public abstract void SetBonePreset()
Declaration
public void SetTargetTransform(Transform targetTransform)
Parameters
Type |
Name |
Description |
Transform |
targetTransform |
|
Starts the aiming at the target with the given layer and target
Declaration
public void SetupAndStart(Transform target, bool shouldDestroyItself = true)
Parameters
Type |
Name |
Description |
Transform |
target |
The transform of the object that should be aimed at
|
Boolean |
shouldDestroyItself |
If the component should destroy itself after aiming is stopped
|
Start()
Declaration
protected virtual void Start()
Stop()
Removes the targetTransform, which results in the aim to return to the starting position, if shouldDestroyItself is set to true, the component will be destroyed after the aim is back at the starting position
Declaration
TemporarilyIncreaseLookSpeed(Single)
Declaration
public void TemporarilyIncreaseLookSpeed(float increase)
Parameters
Type |
Name |
Description |
Single |
increase |
|
UpdateTargetFollower()
Declaration
protected void UpdateTargetFollower()
Instead of using a bone preset, the bones can be selected and weighted manually
Declaration
public void UseNewBoneset(HumanBone[] humanBones, AimAt.AimDirection aimDirection, Transform aimTransform, float angleLimit)
Parameters
Type |
Name |
Description |
HumanBone[] |
humanBones |
The bones and weights that should be moved to accomplish the aiming
|
AimAt.AimDirection |
aimDirection |
The direction going out of the aimTransform that should directly point at the target
|
Transform |
aimTransform |
The last point of the bones that should directly point at the target
|
Single |
angleLimit |
The limit at which pointing will be stopped, i.e. 90f to only aim when target is somewhere in front of the agent
|