Search Results for

    Show / Hide Table of Contents

    Class AimAt

    Implements the functionality of aiming at a target

    Inheritance
    Object
    AimAt
    BaseLayerPreset
    HeadPreset
    LeftArmPreset
    LeftLegPreset
    RightArmPreset
    RightLegPreset
    Namespace: i5.VirtualAgents
    Assembly: cs.temp.dll.dll
    Syntax
    public abstract class AimAt : MonoBehaviour

    Fields

    aimDirection

    Declaration
    protected AimAt.AimDirection aimDirection
    Field Value
    Type Description
    AimAt.AimDirection

    aimTransform

    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
    Type Description
    Single

    boneTransforms

    Declaration
    protected Transform[] boneTransforms
    Field Value
    Type Description
    Transform[]

    currentLookSpeed

    Declaration
    protected float currentLookSpeed
    Field Value
    Type Description
    Single

    distanceLimit

    Declaration
    protected float distanceLimit
    Field Value
    Type Description
    Single

    humanBones

    Declaration
    protected HumanBone[] humanBones
    Field Value
    Type Description
    HumanBone[]

    increaseLookSpeedBy

    Declaration
    protected float increaseLookSpeedBy
    Field Value
    Type Description
    Single

    iterations

    Declaration
    protected int iterations
    Field Value
    Type Description
    Int32

    navMeshAgent

    Declaration
    protected NavMeshAgent navMeshAgent
    Field Value
    Type Description
    NavMeshAgent

    startingTransform

    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

    targetTransform

    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
    Type Description
    Single

    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
    Type Description
    Boolean

    Weight

    Declaration
    public float Weight { get; set; }
    Property Value
    Type Description
    Single

    Methods

    AimAtTarget(Transform, Vector3, Single)

    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
    Type Description
    Vector3

    GetAimDirectionVector()

    Declaration
    protected Vector3 GetAimDirectionVector()
    Returns
    Type Description
    Vector3

    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()

    SetTargetTransform(Transform)

    Declaration
    public void SetTargetTransform(Transform targetTransform)
    Parameters
    Type Name Description
    Transform targetTransform

    SetupAndStart(Transform, Boolean)

    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
    public void Stop()

    TemporarilyIncreaseLookSpeed(Single)

    Declaration
    public void TemporarilyIncreaseLookSpeed(float increase)
    Parameters
    Type Name Description
    Single increase

    UpdateTargetFollower()

    Declaration
    protected void UpdateTargetFollower()

    UseNewBoneset(HumanBone[], AimAt.AimDirection, Transform, Single)

    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

    In This Article
    Back to top Documentation of the Virtual Agents Framework