Class InteractionController
- Namespace
- Interaction
Handles the interactions, i.e. grabbing, releasing, interacting and combining of the TrainARObjects.
public class InteractionController : MonoBehaviour
- Inheritance
-
objectInteractionController
Fields
grabbedObject
The object that is currently grabbed by the user.
public GameObject grabbedObject
Field Value
- GameObject
Changed when TrainAR object is grabbed/released.
grabber
Reference to the grabber object, which becomes the parent of a picked up (grabbed) TrainAR-object.
public GameObject grabber
Field Value
- GameObject
One grabber per scene.
hit
Raycast from the center of the screen to detected if a TrainAR object is aimed at.
[NonSerialized]
public RaycastHit hit
Field Value
- RaycastHit
Null if no gameObject is hit.
intersectedObject
Reference to the intersected TrainAR object.
public GameObject intersectedObject
Field Value
- GameObject
Changed when TrainAR object are intersecting.
isGrabbingObject
Changes value when an object is grabbed/released.
public bool isGrabbingObject
Field Value
- bool
True if a object is grabbed.
isIntersecting
Changed on intersection.
public bool isIntersecting
Field Value
- bool
True if TrainAR objects ar intersecting.
isSelectingObject
Changed when TrainAR object is selected/deselected.
public bool isSelectingObject
Field Value
- bool
True if a object is selected.
selectedObject
Reference to the current selected(aimed at) TrainAR object.
public GameObject selectedObject
Field Value
- GameObject
Changed on selection.
tryedGrabbingObjectUnsuccessfully
Value is changed when the grab button is pressed.
public bool tryedGrabbingObjectUnsuccessfully
Field Value
- bool
True if a grabbing of an object was not successfull.
Methods
Combine()
Invokes the Combine on the TrainARObject. Important: This method assumes there is an object selected and it is currently intersecting with another. It also assumes that ARInteractables have an ObjectInteraktionhandler.
public void Combine()
GrabObject()
Grab the object that is currently selected by the raycast.
public void GrabObject()
Interact()
Invokes the Interact on the TrainARObject. Important: This method assumes there is an object selected! It also assumes that ARInteractables have an ObjectInteraktionhandler.
public void Interact()
ReleaseGrabbedObject(bool)
Release the currently grabbed object.
public void ReleaseGrabbedObject(bool fusedObject = false)
Parameters
fusedObjectbool