private void SetupSecondaryGrab(VRTK_InteractableObject givenObject) { VRTK_BaseGrabAction grab = givenObject.GetComponentInChildren <VRTK_BaseGrabAction>(); if (grab != null) { DestroyImmediate(grab); } switch (secGrab) { case SecondaryGrab.SwapControllers: grab = givenObject.gameObject.AddComponent <VRTK_SwapControllerGrabAction>(); break; case SecondaryGrab.ControlDirection: grab = givenObject.gameObject.AddComponent <VRTK_ControlDirectionGrabAction>(); break; case SecondaryGrab.AxisScale: grab = givenObject.gameObject.AddComponent <VRTK_AxisScaleGrabAction>(); break; default: grab = givenObject.gameObject.AddComponent <VRTK_SwapControllerGrabAction>(); break; } givenObject.secondaryGrabActionScript = grab; }
private void SetupHaptics(VRTK_InteractableObject givenObject) { if (addHaptics) { VRTK_InteractHaptics haptics = givenObject.GetComponentInChildren <VRTK_InteractHaptics>(); if (haptics == null) { givenObject.gameObject.AddComponent <VRTK_InteractHaptics>(); } } }
private void SetupHighlighter(VRTK_InteractableObject givenObject) { if (touchColor != Color.clear) { VRTK_InteractObjectHighlighter highlighter = givenObject.GetComponentInChildren <VRTK_InteractObjectHighlighter>(); if (highlighter == null) { highlighter = givenObject.gameObject.AddComponent <VRTK_InteractObjectHighlighter>(); } highlighter.touchHighlight = touchColor; } }
private void SetupPrimaryGrab(VRTK_InteractableObject givenObject) { VRTK_BaseGrabAttach grab = givenObject.GetComponentInChildren <VRTK_BaseGrabAttach>(); if (grab != null) { DestroyImmediate(grab); } switch (primGrab) { case PrimaryGrab.ChildOfController: grab = givenObject.gameObject.AddComponent <VRTK_ChildOfControllerGrabAttach>(); break; case PrimaryGrab.FixedJoint: grab = givenObject.gameObject.AddComponent <VRTK_FixedJointGrabAttach>(); break; case PrimaryGrab.Climbable: grab = givenObject.gameObject.AddComponent <VRTK_ClimbableGrabAttach>(); break; case PrimaryGrab.CustomJoint: grab = givenObject.gameObject.AddComponent <VRTK_CustomJointGrabAttach>(); break; case PrimaryGrab.RotatorTrack: grab = givenObject.gameObject.AddComponent <VRTK_RotatorTrackGrabAttach>(); break; case PrimaryGrab.SpringJoint: grab = givenObject.gameObject.AddComponent <VRTK_SpringJointGrabAttach>(); break; case PrimaryGrab.TrackObject: grab = givenObject.gameObject.AddComponent <VRTK_TrackObjectGrabAttach>(); break; default: grab = givenObject.gameObject.AddComponent <VRTK_ChildOfControllerGrabAttach>(); break; } givenObject.grabAttachMechanicScript = grab; }