//SNAP SLICE TO WALL void OnTriggerEnter(Collider other) { if (!isActivated) { if (other.gameObject.name == objectToSnapName) { quad = other.gameObject; grabQuadScript = quad.GetComponent <grabQuad>(); rotateQuadScript = quad.GetComponent <rotateQuad>(); isInsideSnapZone = true; isActivated = true; } } }
//UNSNAP SLICE FROM WALL void OnTriggerExit(Collider other) { if (isActivated) { if (other.gameObject.name == objectToSnapName) { quad = null; grabQuadScript = null; rotateQuadScript = null; isInsideSnapZone = false; isActivated = false; } } }
protected override void Awake() { base.Awake(); base.smoothPosition = true; base.smoothPositionAmount = 20.0f; base.tightenPosition = 0.345f; base.trackRotation = false; base.smoothRotationAmount = 20.0f; base.tightenRotation = 0.345f; base.throwOnDetach = false; dicomImageQuad = GameObject.Find("Dicom_Image_Quad"); audioFXSource = dicomImageQuad.GetComponent <setQuadAudio>().audioFXSource; onButtonPressDown = dicomImageQuad.GetComponent <setQuadAudio>().onButtonPressDown; onButtonPressUp = dicomImageQuad.GetComponent <setQuadAudio>().onButtonPressUp; selectColorForHandMode = dicomImageQuad.GetComponent <setQuadFrameColors>().handTranslate; activateColorForHandMode = dicomImageQuad.GetComponent <setQuadFrameColors>().handRotate; selectColorForJoystickMode = dicomImageQuad.GetComponent <setQuadFrameColors>().joystickTranslate; activateColorForJoystickMode = dicomImageQuad.GetComponent <setQuadFrameColors>().joystickRotate; inactiveColor = dicomImageQuad.GetComponent <setQuadFrameColors>().defaultFrameColor; quadRenderer = this.GetComponent <Renderer>(); quadMaterial = quadRenderer.material; xrRig = GameObject.Find("XR Rig"); moveLocomotionScript = xrRig.GetComponent <moveLocomotion>(); snapTurnProviderScript = xrRig.GetComponent <SnapTurnProvider>(); inactiveMoveSpeed = moveLocomotionScript.moveSpeed; rotateQuadScript = this.GetComponent <rotateQuad>(); duplicateQuadScript = this.GetComponent <duplicateQuad>(); if (this.gameObject.tag != "Duplicate") { adjustQuadScript = this.GetComponent <adjustQuad>(); } }