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
Namespace: Interaction
Assembly: Assembly-CSharp.dll
Syntax
public class TrainARObject : MonoBehaviour
Fields
| Improve this Doc View Sourceerror
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 |
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 |
---|---|
System.String | String based on the object name. |
Intersection
The Object this object is currently intersecting with.
Declaration
public CollisionController.Intersection Intersection
Field Value
Type | Description |
---|---|
CollisionController.Intersection | Is set on runtime. |
isCombinable
Is the object combineable?
Declaration
public bool isCombinable
Field Value
Type | Description |
---|---|
System.Boolean | If true it is combinable. |
isGrabbable
Is the object grabbable?
Declaration
public bool isGrabbable
Field Value
Type | Description |
---|---|
System.Boolean | If true it is grabbable. |
isGrabbed
Declaration
public bool isGrabbed
Field Value
Type | Description |
---|---|
System.Boolean |
isInteractable
Is the object interactable?
Declaration
public bool isInteractable
Field Value
Type | Description |
---|---|
System.Boolean | If true it is interactable. |
isSelected
Declaration
public bool isSelected
Field Value
Type | Description |
---|---|
System.Boolean |
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 |
---|---|
System.Single | Default is 0.2f |
OnCombination
Declaration
public TrainARObject.CustomUnityEvent OnCombination
Field Value
Type | Description |
---|---|
TrainARObject.CustomUnityEvent |
OnDeselect
Declaration
public UnityEvent OnDeselect
Field Value
Type | Description |
---|---|
UnityEvent |
OnGrabbed
Declaration
public UnityEvent OnGrabbed
Field Value
Type | Description |
---|---|
UnityEvent |
OnInteraction
Declaration
public UnityEvent OnInteraction
Field Value
Type | Description |
---|---|
UnityEvent |
OnReleased
Declaration
public UnityEvent OnReleased
Field Value
Type | Description |
---|---|
UnityEvent |
OnSelect
Declaration
public UnityEvent OnSelect
Field Value
Type | Description |
---|---|
UnityEvent |
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). |
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). |
TrainARObjectDisabled
If true the object is not selectable, grabbable, interactable, combineable but might be visible.
Declaration
public bool TrainARObjectDisabled
Field Value
Type | Description |
---|---|
System.Boolean | Default is false. |
Methods
| Improve this Doc View SourceCombine(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 |
---|---|---|
System.String | combinedWithName | |
GameObject | intersectedObject |
Deselect()
Invokes the Deselect event of this TrainARObject and sets it's isSelected bool accordingly.
Declaration
public void Deselect()
DisableTrainARObject()
Disables interactions with this TrainARObject by disabling it's colliders and Mesh Renderer.
Declaration
public void DisableTrainARObject()
EnableTrainARObject()
Enables interactions with this TrainARObject by disabling it's colliders and Mesh Renderer.
Declaration
public void EnableTrainARObject()
Error()
Invokes the error event of this TrainARObject.
Declaration
public void Error()
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 |
---|---|
System.Boolean |
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 |
---|---|---|
System.String | parameter | A string parameter which is passed to the statemachine. |
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()
Select()
Invokes the select event of this TrainARObject and sets it's isSelected bool accordingly.
Declaration
public void Select()