Target Indicators
Search Results for

    Show / Hide Table of Contents

    Class TargetIndicatorManager

    Tracks targets and transforms their world space positions into screen space coordinates with options to clamp to the screen edges, absolute size, or a compass tape. Useful for displaying directions to targets and other positions in the environment.

    Inheritance
    object
    TargetIndicatorManager
    Namespace: TargetIndicators
    Assembly: TargetIndicators.dll
    Syntax
    public class TargetIndicatorManager : MonoBehaviour

    Constructors

    TargetIndicatorManager()

    Declaration
    public TargetIndicatorManager()

    Properties

    BottomPadding

    The distance in pixels from the bottom edge of the screen for Padded boundary type.

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

    BoundaryShape

    The shape of the boundary to clamp target indicators to.

    Declaration
    public BoundaryShape BoundaryShape { get; set; }
    Property Value
    Type Description
    BoundaryShape

    BoundaryType

    The type of boundary to clamp target indicators to.

    Declaration
    public BoundaryType BoundaryType { get; set; }
    Property Value
    Type Description
    BoundaryType

    Camera

    The scene camera that is used to calculate screen pose of tracked targets.

    Declaration
    public Camera Camera { get; set; }
    Property Value
    Type Description
    Camera

    Ellipse

    The definition of the currently configured ellipse if BoundaryShape is set to Ellipse.

    Declaration
    public Ellipse Ellipse { get; }
    Property Value
    Type Description
    Ellipse

    Height

    The height in pixels centered at the screen center for Absolute boundary type.

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

    LeftPadding

    The distance in pixels from the left edge of the screen for Padded boundary type.

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

    MaxTargets

    The max number of targets that can be tracked.

    Declaration
    public int MaxTargets { get; }
    Property Value
    Type Description
    int

    Rectangle

    The definition of the currently configured rectangle if BoundaryShape is set to Rectangle.

    Declaration
    public Rect Rectangle { get; }
    Property Value
    Type Description
    Rect

    RightPadding

    The distance in pixels from the right edge of the screen for Padded boundary type.

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

    TopPadding

    The distance in pixels from the top edge of the screen for Padded boundary type.

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

    TrackedTargetsCount

    The current number of targets being tracked.

    Declaration
    public int TrackedTargetsCount { get; }
    Property Value
    Type Description
    int

    Width

    The width in pixels centered at the screen center for Absolute boundary type.

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

    Methods

    GetScreenPose(in Vector3, out bool)

    Gets the screen pose of a world space position.

    Declaration
    public Pose GetScreenPose(in Vector3 worldSpacePosition, out bool isOutsideBoundary)
    Parameters
    Type Name Description
    Vector3 worldSpacePosition

    The world space position to convert to the screen pose.

    bool isOutsideBoundary

    true if the screen pose of worldSpacePosition is outside of the configured boundary. Otherwise, false.

    Returns
    Type Description
    Pose

    The screen space pose of worldSpacePosition.

    IsOutsideBoundary(in Vector3)

    checks if the screen space position is outside the configured boundary.

    Declaration
    public bool IsOutsideBoundary(in Vector3 screenPoint)
    Parameters
    Type Name Description
    Vector3 screenPoint

    The screen point to test. Requires the point as a Vector3 to allow for the inclusion of the depth from the camera in world space for faster calculations. If unknown, set screenPoint.z to 0.

    Returns
    Type Description
    bool

    true if screenPoint is outside the configured boundary. Otherwise, false.

    RemoveAllTargets()

    Removes all targets that are being tracked.

    Declaration
    public void RemoveAllTargets()

    TryAddTarget(Transform, out TargetIndicator)

    Attempts to add a new target to be tracked. This can only fail if the TrackedTargetsCount equals MaxTargets.

    Declaration
    public bool TryAddTarget(Transform target, out TargetIndicator targetIndicator)
    Parameters
    Type Name Description
    Transform target

    The transform of the target to track.

    TargetIndicator targetIndicator

    The created TargetIndicator for the current frame of the target's position.

    Returns
    Type Description
    bool

    true if the target was added, otherwise false.

    TryGetTargetIndicator(TargetIndicatorId, out TargetIndicator)

    Attempts to get the TargetIndicator for the corresponding TargetIndicatorId.

    Declaration
    public bool TryGetTargetIndicator(TargetIndicatorId targetIndicatorId, out TargetIndicator targetIndicator)
    Parameters
    Type Name Description
    TargetIndicatorId targetIndicatorId

    The ID of the target indicator.

    TargetIndicator targetIndicator

    The TargetIndicator associated with targetIndicatorId.

    Returns
    Type Description
    bool

    true if the targetIndicatorId is valid and being tracked. Otherwise, false.

    TryRemoveTarget(TargetIndicatorId)

    Attempts to remove a target indicator.

    Declaration
    public bool TryRemoveTarget(TargetIndicatorId targetIndicatorId)
    Parameters
    Type Name Description
    TargetIndicatorId targetIndicatorId

    The ID of the target indicator to remove.

    Returns
    Type Description
    bool

    true if the targetIndicatorId is valid and being tracked. Otherwise false.

    Events

    TargetIndicatorsAdded

    Invoked when target indicators have been added.

    Declaration
    public event TargetIndicatorManager.TargetIndicatorsUpdatedDelegate TargetIndicatorsAdded
    Event Type
    Type Description
    TargetIndicatorManager.TargetIndicatorsUpdatedDelegate

    TargetIndicatorsRemoved

    Invoked when target indicators have been removed.

    Declaration
    public event TargetIndicatorManager.TargetIndicatorsRemovedDelegate TargetIndicatorsRemoved
    Event Type
    Type Description
    TargetIndicatorManager.TargetIndicatorsRemovedDelegate

    TargetIndicatorsUpdated

    Invoked when target indicators have been updated.

    Declaration
    public event TargetIndicatorManager.TargetIndicatorsUpdatedDelegate TargetIndicatorsUpdated
    Event Type
    Type Description
    TargetIndicatorManager.TargetIndicatorsUpdatedDelegate
    In this article
    Back to top Generated by DocFX