Search Results for

    Show / Hide Table of Contents

    Class TrainARObject

    The main behaviour script for a TrainAR object. This is automatically added when converting GameObject to TrainAR objects After adding this script all following RequiredComponents are added. SelectionBase, MeshCollider, BoxCollider, RigidbodyController, MaterialController, AudioController, Rigidbody, Outline, CollisionController. The TrainAR events that are triggered on actions are also defined in this script.

    Inheritance
    object
    TrainARObject
    Namespace: Interaction
    Assembly: .dll
    Syntax
    public class TrainARObject : MonoBehaviour

    Fields

    | Edit this page View Source

    Intersection

    The Object this object is currently intersecting with.

    Declaration
    [NonSerialized]
    public CollisionController.Intersection Intersection
    Field Value
    Type Description
    CollisionController.Intersection

    Is set on runtime.

    | Edit this page View Source

    OnCombination

    Declaration
    public TrainARObject.CustomUnityEvent OnCombination
    Field Value
    Type Description
    TrainARObject.CustomUnityEvent
    | Edit this page View Source

    OnDeselect

    Declaration
    public UnityEvent OnDeselect
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    OnGrabbed

    Declaration
    public UnityEvent OnGrabbed
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    OnInteraction

    Declaration
    public UnityEvent OnInteraction
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    OnReleased

    Declaration
    public UnityEvent OnReleased
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    OnSelect

    Declaration
    public UnityEvent OnSelect
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    TrainARObjectDisabled

    If true the object is not selectable, grabbable, interactable, combineable but might be visible.

    Declaration
    public bool TrainARObjectDisabled
    Field Value
    Type Description
    bool

    Default is false.

    | Edit this page View Source

    error

    Error event. Triggered when an action is triggered on this TrainAR object that was not accepted by the statemachine.

    Declaration
    public UnityEvent error
    Field Value
    Type Description
    UnityEvent
    | Edit this page View Source

    interactableName

    The name of the TrainAR object that is used for the statemachine check. By default, this is the name of the TrainAR object.

    Declaration
    public string interactableName
    Field Value
    Type Description
    string

    String based on the object name.

    | Edit this page View Source

    isCombinable

    Is the object combineable?

    Declaration
    public bool isCombinable
    Field Value
    Type Description
    bool

    If true it is combinable.

    | Edit this page View Source

    isGrabbable

    Is the object grabbable?

    Declaration
    public bool isGrabbable
    Field Value
    Type Description
    bool

    If true it is grabbable.

    | Edit this page View Source

    isGrabbed

    Declaration
    public bool isGrabbed
    Field Value
    Type Description
    bool
    | Edit this page View Source

    isInteractable

    Is the object interactable?

    Declaration
    public bool isInteractable
    Field Value
    Type Description
    bool

    If true it is interactable.

    | Edit this page View Source

    isSelected

    Declaration
    public bool isSelected
    Field Value
    Type Description
    bool
    | Edit this page View Source

    lerpingDistance

    The distance in front of the camera, where the object is lerped to. This can e.g. be useful, if objects are larger than usual.

    Declaration
    public float lerpingDistance
    Field Value
    Type Description
    float

    Default is 0.2f

    | Edit this page View Source

    pivotOffsetPosition

    Offset of the pivot point. Use this, if the given pivot point by the model is weird.

    Declaration
    public Vector3 pivotOffsetPosition
    Field Value
    Type Description
    Vector3

    Default is (0, 0, 0).

    | Edit this page View Source

    pivotOffsetRotation

    Offset of the pivot rotation. Use this, if the given pivot point by the model is weird.

    Declaration
    public Vector3 pivotOffsetRotation
    Field Value
    Type Description
    Vector3

    Default is (0, 0, 0).

    Methods

    | Edit this page View Source

    Combine(string, GameObject)

    Sends a request to the statemachine to check if this combine was valid. If so, the combine event of this TrainARObject is invoked otherwise the error event is invoked instead.

    This does NOT physically combine the object, which has to be handled by hand or e.g. the TrainAR Object helper in the visual scripting.

    Declaration
    public void Combine(string combinedWithName, GameObject intersectedObject)
    Parameters
    Type Name Description
    string combinedWithName
    GameObject intersectedObject
    | Edit this page View Source

    Deselect()

    Invokes the Deselect event of this TrainARObject and sets it's isSelected bool accordingly.

    Declaration
    public void Deselect()
    | Edit this page View Source

    DisableTrainARObject()

    Disables interactions with this TrainARObject by disabling it's colliders and Mesh Renderer.

    Declaration
    public void DisableTrainARObject()
    | Edit this page View Source

    EnableTrainARObject()

    Enables interactions with this TrainARObject by disabling it's colliders and Mesh Renderer.

    Declaration
    public void EnableTrainARObject()
    | Edit this page View Source

    Error()

    Invokes the error event of this TrainARObject.

    Declaration
    public void Error()
    | Edit this page View Source

    Grab()

    Sends a request to the statemachine to check if this grab was valid. If so, the grab event of this TrainARObject is invoked otherwise the error event is invoked instead.

    This does NOT grab the object, which is handled in the InteractionController

    Declaration
    public bool Grab()
    Returns
    Type Description
    bool
    | Edit this page View Source

    Interact(string)

    Sends a request to the statemachine to check if this interaction was valid. If so, the interact event of this TrainARObject is invoked otherwise the error event is invoked instead.

    Declaration
    public void Interact(string parameter = " ")
    Parameters
    Type Name Description
    string parameter

    A string parameter which is passed to the statemachine.

    | Edit this page View Source

    Release()

    Invokes the Release event of this TrainARObject and sets it's isGrabbed bool accordingly.

    This does NOT release the object, which is handled in the InteractionController

    Declaration
    public void Release()
    | Edit this page View Source

    Select()

    Invokes the select event of this TrainARObject and sets it's isSelected bool accordingly.

    Declaration
    public void Select()
    • Edit this page
    • View Source
    In this article
    Back to top TrainAR Documentation