void OnPreCull()
    {
        if (_core != null)
        {
            // Specify the correct eye.
            ZSCore.Eye eye = ZSCore.Eye.Left;

            if (_core.AreEyesSwapped())
            {
                eye = ZSCore.Eye.Right;
            }

            if (_core.CurrentCamera != null && _stereoRig != null)
            {
                // Grab the current monoscopic camera's transform and apply it
                // to the ZSStereoRig.
                _stereoRig.transform.position   = _core.CurrentCamera.transform.position;
                _stereoRig.transform.rotation   = _core.CurrentCamera.transform.rotation;
                _stereoRig.transform.localScale = _core.CurrentCamera.transform.localScale;
            }

            // Calculate left camera's transform.
            Matrix4x4 viewMatrixInverse = ZSCore.ConvertFromRightToLeft(_core.GetViewMatrix(eye).inverse);
            transform.localPosition = viewMatrixInverse.GetColumn(3);
            transform.localRotation = Quaternion.LookRotation(viewMatrixInverse.GetColumn(2), viewMatrixInverse.GetColumn(1));

            // Set the left camera's projection matrix.
            gameObject.camera.projectionMatrix = _core.GetProjectionMatrix(eye);
        }

        GL.IssuePluginEvent((int)ZSCore.GlPluginEventType.RenderTargetLeft);
    }
Пример #2
0
    void Start()
    {
        GameObject coreObject = GameObject.Find("ZSCore");

        if (coreObject != null)
          m_core = coreObject.GetComponent<ZSCore>();
    }
Пример #3
0
    protected override void OnScriptAwake()
    {
        base.OnScriptAwake();

        _core = GameObject.Find("ZSCore").GetComponent<ZSCore>();
        _camera = _core.CurrentCamera.camera;
    }
Пример #4
0
    protected override void OnScriptAwake()
    {
        base.OnScriptAwake();

        _core   = GameObject.Find("ZSCore").GetComponent <ZSCore>();
        _camera = _core.CurrentCamera.GetComponent <Camera>();
    }
Пример #5
0
    protected void Start()
    {
        _zsCore          = GameObject.Find("ZSCore").GetComponent <ZSCore> ();
        _zsCore.Updated += new ZSCore.CoreEventHandler(OnCoreUpdated);
        initialRotation  = transform.rotation;
        initialPosition  = transform.position;

        collidingWith = new List <GameObject>();
    }
Пример #6
0
    protected override void OnScriptAwake()
    {
        base.OnScriptAwake();

        _core = GameObject.Find("ZSCore").GetComponent<ZSCore>();

        if (Target == null)
            _displayBounds = GameObject.Find("DisplayPlane").GetComponent<DisplayBounds>();
    }
Пример #7
0
    protected override void OnScriptAwake()
    {
        base.OnScriptAwake();

        _core = GameObject.FindObjectOfType(typeof(ZSCore)) as ZSCore;

        for (int i = 0; i < _targetInfos.Length; ++i)
            _targetInfos[i] = new TargetInfo(_core, (ZSCore.TrackerTargetType)i);
    }
Пример #8
0
    protected void Start()
    {
        _zsCore          = GameObject.Find("ZSCore").GetComponent <ZSCore> ();
        _zsCore.Updated += new ZSCore.CoreEventHandler(OnCoreUpdated);
        initialRotation  = transform.rotation;
        initialPosition  = transform.position;

        contactPoint = GameObject.Find("ContactPoint");
        contactPoint.SetActive(false);
        lastHoveredGO = null;
    }
Пример #9
0
    /// called by ZSCore after each input update.
    private void OnCoreUpdated(ZSCore sender)
    {
        UpdateStylusPose();
        if (collidingWith.Count > 0)
        {
            if (_zsCore.IsTrackerTargetButtonPressed(ZSCore.TrackerTargetType.Primary, 0))
            {
                for (int i = 0; i < collidingWith.Count; i++)
                {
                    collidingWith [i].GetComponent <Renderer> ().material.color = Color.black;
                }

                if (collidingWith.Count == 1)
                {
                    if (interactingWith == null && !GameState.replayOn)
                    {
                        interactingWith = collidingWith [0];
                    }
                }
            }
            else
            {
                for (int i = 0; i < collidingWith.Count; i++)
                {
                    collidingWith [i].GetComponent <Renderer>().material.color = new Color(0.8f, 0.8f, 0.8f);
                    collidingWith [i].GetComponent <Interact> ().interact      = false;
                    interactingWith = null;
                }
            }
        }

        if (_zsCore.IsTrackerTargetButtonPressed(ZSCore.TrackerTargetType.Primary, 0) && interactingWith != null)
        {
            interactingWith.GetComponent <Interact> ().interact = true;
            interactingWith.GetComponent <Interact> ().penPos   = transform.position;
            interactingWith.GetComponent <Interact> ().penRot   = transform.rotation;
        }
        else if (interactingWith != null)
        {
            interactingWith.GetComponent <Interact> ().interact = false;
            if (interactingWith.layer == 8)
            {
                interactingWith.GetComponent <Rigidbody>().useGravity = true;                                       /// can't use with widgets
                interactingWith.transform.SetParent(interactingWith.GetComponent <BlockInteraction> ().lastParent); //// can't use with widgets
            }
            interactingWith = null;
        }
        else if (!_zsCore.IsTrackerTargetButtonPressed(ZSCore.TrackerTargetType.Primary, 0))
        {
            // loop through pen's children and reset them
        }
    }
Пример #10
0
    /****************************/
    protected void Start()
    {
        _zsCore          = GameObject.Find("ZSCore").GetComponent <ZSCore> ();
        _zsCore.Updated += new ZSCore.CoreEventHandler(OnCoreUpdated);
        initialRotation  = transform.rotation;
        initialPosition  = transform.position;

        contactPoint = GameObject.Find("ContactPoint");
        contactPoint.SetActive(false);
        lastHoveredGO    = null;
        firstWidgetPress = false;

        timeFirstClick    = -10.0f;
        timeFirstRelease  = false;
        timeSecondClick   = 0.0f;
        timeSecondRelease = true;
    }
Пример #11
0
    // Use this for initialization
    void Start()
    {
        // Check to make sure the application is running in the editor.
        if (!Application.isEditor)
          return;

        GameObject coreObject = GameObject.Find("ZSCore");
        m_coreDiagnosticWindow = (ZSCoreDiagnosticWindow)EditorWindow.GetWindow(typeof(ZSCoreDiagnosticWindow));

        if (coreObject != null)
          m_core = coreObject.GetComponent<ZSCore>();

        if (m_core != null)
        {
          m_stylusButtonStates = new bool[m_core.GetNumTrackerTargetButtons(ZSCore.TrackerTargetType.Primary)];

          LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
          lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
          lineRenderer.SetColors(Color.white, Color.white);
        }
    }
Пример #12
0
    void OnPreCull()
    {
        if (_core != null)
        {
            // Specify the correct eye.
            ZSCore.Eye eye = ZSCore.Eye.Center;

            // Calculate right camera's transform.
            Matrix4x4 viewMatrixInverse = ZSCore.ConvertFromRightToLeft(_core.GetViewMatrix(eye).inverse);
            transform.localPosition = viewMatrixInverse.GetColumn(3);
            transform.localRotation = Quaternion.LookRotation(viewMatrixInverse.GetColumn(2), viewMatrixInverse.GetColumn(1));

            // Set the right camera's projection matrix.
            gameObject.GetComponent <Camera>().projectionMatrix = _core.GetProjectionMatrix(eye);
        }

        // Signal that the frame is done and reset the Unity's OpenGl state.
        GL.IssuePluginEvent((int)ZSCore.GlPluginEventType.FrameDone);
        GL.IssuePluginEvent((int)ZSCore.GlPluginEventType.DisableStereo);
        GL.InvalidateState();

        gameObject.GetComponent <Camera>().enabled = false;
    }
Пример #13
0
    void OnPreCull()
    {
        if (_core != null)
        {
            // Specify the correct eye.
            ZSCore.Eye eye = ZSCore.Eye.Right;

            if (_core.AreEyesSwapped())
            {
                eye = ZSCore.Eye.Left;
            }

            // Calculate right camera's transform.
            Matrix4x4 viewMatrixInverse = ZSCore.ConvertFromRightToLeft(_core.GetViewMatrix(eye).inverse);
            transform.localPosition = viewMatrixInverse.GetColumn(3);
            transform.localRotation = Quaternion.LookRotation(viewMatrixInverse.GetColumn(2), viewMatrixInverse.GetColumn(1));

            // Set the right camera's projection matrix.
            gameObject.GetComponent <Camera>().projectionMatrix = _core.GetProjectionMatrix(eye);
        }

        GL.IssuePluginEvent((int)ZSCore.GlPluginEventType.RenderTargetRight);
    }
Пример #14
0
    /// <summary>
    /// This function is called by ZSCore after each input update.
    /// </summary>
    private void OnCoreUpdated(ZSCore sender)
    {
        if (sender != _zsCore)
        {
            return;
        }

        //Update stylus button states.
        for (int i = 0; i < numButtons; ++i)
        {
            _wasStylusButtonPressed [i] = _isStylusButtonPressed [i];
            _wasMouseButtonPressed [i]  = _isMouseButtonPressed [i];

            //Have to combine mouse state down here so asynchronous clients see it at the right time.
            _isStylusButtonPressed [i] = !_zsCore.IsMouseEmulationEnabled() && _zsCore.IsTrackerTargetButtonPressed(ZSCore.TrackerTargetType.Primary, i);
            _isMouseButtonPressed [i]  = Input.GetMouseButton(i);
        }

        bool useMousePointer = false;

        if (_useTracking && !_zsCore.IsMouseEmulationEnabled())
        {
            Matrix4x4 pose = _zsCore.GetTrackerTargetWorldPose(_targetType);
            if (pose != _previousStylusPose)
            {
                _timeSinceStylusMoved = 0f;
            }
            else
            {
                _timeSinceStylusMoved += Time.deltaTime;
            }

            useMousePointer = _timeSinceStylusMoved > StylusTimeout;
            if (!useMousePointer)
            {
                _previousStylusPose  = pose;
                transform.localScale = ZSStylusSelector.GetScale(pose);
                transform.rotation   = ZSStylusSelector.GetRotation(pose);
                transform.position   = ZSStylusSelector.GetPosition(pose);

                transform.localScale = _zsCore.GetViewerScale() * Vector3.one;
            }
        }

        //Simulate the stylus based on mouse input.

        Vector3 dMousePosition = Input.mousePosition - _lastMousePosition;

        dMousePosition [2] = WheelSensitivity * Input.GetAxis("Mouse ScrollWheel");
        if (Input.GetKey(KeyCode.LeftBracket))
        {
            dMousePosition [2] -= WheelSensitivity * Time.deltaTime;
        }
        if (Input.GetKey(KeyCode.RightBracket))
        {
            dMousePosition [2] += WheelSensitivity * Time.deltaTime;
        }

        Camera mainCamera = (_zsCore.IsStereoEnabled()) ? _centerCamera : _zsCore.CurrentCamera.camera;

        if (useMousePointer && mainCamera != null && mainCamera.enabled)
        {
            if (stylusSimulatorMode == StylusSimulatorMode.Projection || stylusSimulatorMode == StylusSimulatorMode.Position)
            {
                //Only update the wheel total if we aren't rotating.  Avoids extra Z translation artifact.
                _mouseWheel += dMousePosition [2];
                Ray     ray      = mainCamera.ScreenPointToRay(Input.mousePosition);
                Vector3 rayPoint = ray.GetPoint(0.1f + 0.5f * _mouseWheel * mainCamera.transform.localScale.magnitude);
                transform.position = rayPoint;

                if (stylusSimulatorMode == StylusSimulatorMode.Projection)
                {
                    transform.rotation = Quaternion.LookRotation(ray.GetPoint(1.0f) - mainCamera.transform.position, mainCamera.transform.up);
                }
            }
            else if (stylusSimulatorMode == StylusSimulatorMode.Rotation)
            {
                Vector3 euler = transform.localRotation.eulerAngles;
                euler += new Vector3(-0.1f * dMousePosition.y, 0.1f * dMousePosition.x, -1000.0f * dMousePosition.z);
                var oldHoverPoint = transform.TransformPoint(_localHoverPoint);
                transform.localRotation  = Quaternion.Euler(euler);
                transform.localPosition += oldHoverPoint - transform.TransformPoint(_localHoverPoint);
            }
        }

        //Make the hovered object the closest one to the tip.

        if (_useCollision)
        {
            _hoverQueue.update();
            RaycastHit hit = _hoverQueue.getFirst();
            if (hit.collider != null)
            {
                HoverPoint  = hit.point;
                HoverObject = (hit.collider.gameObject.layer == uiLayer) ?
                              hit.collider.gameObject :
                              objectResolver(hit.collider.gameObject);
            }
            else
            {
                ZSLinearShape linearStylus = activeStylus as ZSLinearShape;
                if (linearStylus != null && linearStylus._tip != null && linearStylus._tip.activeSelf)
                {
                    HoverPoint = linearStylus._tip.transform.position;
                }
                else
                {
                    HoverPoint = activeStylus.hotSpot;
                }
                HoverObject = null;
            }
        }
        else
        {
            HoverPoint = transform.TransformPoint(_localHoverPoint);
        }

        if (_HoverObject != null)
        {
            activeStylus.OnHoverStay(_HoverObject, HoverPoint);
        }

        //Update the set of selected objects based on clicking.

        if (GetButtonDown(SelectButton))
        {
            if (!Input.GetKey(KeyCode.LeftControl))
            {
                selectedObjects.Clear();
            }

            if (_HoverObject != null)
            {
                if (_HoverObject.layer == uiLayer)
                {
                    _wasHoveredObjectSelected = false;
                }
                else
                {
                    _wasHoveredObjectSelected = selectedObjects.Contains(_HoverObject);
                    if (!selectedObjects.Contains(_HoverObject))
                    {
                        selectedObjects.Add(_HoverObject);
                    }
                }
            }

            _buttonDownPosition = transform.position;
        }

        if (GetButtonUp(SelectButton))
        {
            bool wasDrag = (transform.position - _buttonDownPosition).magnitude > minDragDistance;
            if (_HoverObject != null && _wasHoveredObjectSelected && !wasDrag && Input.GetKey(KeyCode.LeftControl))
            {
                selectedObjects.Remove(_HoverObject);
            }
        }

        // Send messages to objects whose selection state changed.

        foreach (GameObject selectedObject in _oldSelectedObjects)
        {
            if (selectedObject != null && !selectedObjects.Contains(selectedObject))
            {
                activeStylus.OnDeselected(selectedObject);
                selectedObject.SendMessage("OnDeselected", SendMessageOptions.DontRequireReceiver);
            }
        }

        GameObject[] tmpSelectedObjects = new GameObject[selectedObjects.Count];
        selectedObjects.CopyTo(tmpSelectedObjects);                          // So objects can de-select themselves.
        foreach (GameObject selectedObject in tmpSelectedObjects)
        {
            if (selectedObject != null && !_oldSelectedObjects.Contains(selectedObject))
            {
                selectedObject.SendMessage("OnSelected", SendMessageOptions.DontRequireReceiver);
                activeStylus.OnSelected(selectedObject, HoverPoint);
            }
        }

        _oldSelectedObjects.Clear();
        foreach (GameObject selectedObject in selectedObjects)
        {
            if (selectedObject != null)
            {
                _oldSelectedObjects.Add(selectedObject);
            }
        }

        _lastMousePosition = Input.mousePosition;

        activeStylus.Tool.OnStylus();
    }
Пример #15
0
 /// <summary>
 /// Creates a HoverQueue for the given ZSStylusSelector.
 /// Only objects in the given bitmask of layers will be considered.
 /// </summary>
 public HoverQueue(ZSStylusSelector stylusSelector, int layerMask, ZSCore core)
 {
     _layerMask      = layerMask;
     _stylusSelector = stylusSelector;
     _core           = core;
 }
Пример #16
0
    protected override void OnScriptAwake()
    {
        base.OnScriptAwake();

        _zsCore = GameObject.Find("ZSCore").GetComponent <ZSCore> ();
    }
Пример #17
0
 void start()
 {
     _core = GameObject.Find("ZSCore").GetComponent<ZSCore>();
     _stylusSelector = GameObject.Find("ZSStylusSelector").GetComponent<ZSStylusSelector>();
 }
Пример #18
0
 void Awake()
 {
     _core = GameObject.Find("ZSCore").GetComponent<ZSCore>();
     _camera = _core.CurrentCamera.camera;
 }
    private void UpdateInternal()
    {
        if (!Application.isPlaying)
        {
          m_core = null;
          m_stylusVisualizationObject = null;
          return;
        }

        if (m_core == null)
        {
          GameObject coreObject = GameObject.Find("ZSCore");

          if (coreObject != null)
        m_core = coreObject.GetComponent<ZSCore>();

          // Set up the stylus visualization.
          m_stylusVisualizationObject = new GameObject("StylusVisualization");
          LineRenderer lineRenderer = m_stylusVisualizationObject.AddComponent<LineRenderer>();
          lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
          lineRenderer.SetColors(Color.white, Color.white);
          lineRenderer.enabled = false;
        }

        if (m_core == null)
          return;

        // Stereo Settings.
        if (m_isStereoEnabled != m_core.IsStereoEnabled())
          m_core.SetStereoEnabled(m_isStereoEnabled);

        if (m_areEyesSwapped != m_core.AreEyesSwapped())
          m_core.SetEyesSwapped(m_areEyesSwapped);

        if (m_interPupillaryDistance != m_core.GetInterPupillaryDistance())
          m_core.SetInterPupillaryDistance(m_interPupillaryDistance);

        if (m_stereoLevel != m_core.GetStereoLevel())
          m_core.SetStereoLevel(m_stereoLevel);

        if (m_worldScale != m_core.GetWorldScale())
          m_core.SetWorldScale(m_worldScale);

        if (m_fieldOfViewScale != m_core.GetFieldOfViewScale())
          m_core.SetFieldOfViewScale(m_fieldOfViewScale);

        if (m_zeroParallaxOffset != m_core.GetZeroParallaxOffset())
          m_core.SetZeroParallaxOffset(m_zeroParallaxOffset);

        if (m_nearClip != m_core.GetNearClip())
          m_core.SetNearClip(m_nearClip);

        if (m_farClip != m_core.GetFarClip())
          m_core.SetFarClip(m_farClip);

        // Head Tracker Settings.
        if (m_isHeadTrackingEnabled != m_core.IsHeadTrackingEnabled())
          m_core.SetHeadTrackingEnabled(m_isHeadTrackingEnabled);

        if (m_headTrackingScale != m_core.GetHeadTrackingScale())
          m_core.SetHeadTrackingScale(m_headTrackingScale);

        // Stylus Tracker Settings.
        if (m_isStylusTrackingEnabled != m_core.IsStylusTrackingEnabled())
          m_core.SetStylusTrackingEnabled(m_isStylusTrackingEnabled);

        // Stylus LED Settings.
        if (m_isStylusLedEnabled != m_core.IsStylusLedEnabled())
          m_core.SetStylusLedEnabled(m_isStylusLedEnabled);

        if (m_stylusLedColor != m_core.GetStylusLedColor())
          m_core.SetStylusLedColor(m_stylusLedColor);

        // Stylus Vibration Settings.
        if (m_isStylusVibrationEnabled != m_core.IsStylusVibrationEnabled())
          m_core.SetStylusVibrationEnabled(m_isStylusVibrationEnabled);

        if (m_stylusVibrationOnPeriod != m_core.GetStylusVibrationOnPeriod())
          m_core.SetStylusVibrationOnPeriod(m_stylusVibrationOnPeriod);

        if (m_stylusVibrationOffPeriod != m_core.GetStylusVibrationOffPeriod())
          m_core.SetStylusVibrationOffPeriod(m_stylusVibrationOffPeriod);

        if (m_stylusVibrationRepeatCount != m_core.GetStylusVibrationRepeatCount())
          m_core.SetStylusVibrationRepeatCount(m_stylusVibrationRepeatCount);

        if (m_startStylusVibration)
        {
          m_core.StartStylusVibration();
          m_startStylusVibration = false;
        }

        if (m_stopStylusVibration)
        {
          m_core.StopStylusVibration();
          m_stopStylusVibration = false;
        }

        // Mouse Emulation Settings.
        if (m_isMouseEmulationEnabled != m_core.IsMouseEmulationEnabled())
          m_core.SetMouseEmulationEnabled(m_isMouseEmulationEnabled);

        if (m_mouseEmulationDistance != m_core.GetMouseEmulationDistance())
          m_core.SetMouseEmulationDistance(m_mouseEmulationDistance);

        // Read Only Display Information.
        m_displayOffset = m_core.GetDisplayOffset();
        m_displayPosition = m_core.GetDisplayPosition();
        m_displayAngle = m_core.GetDisplayAngle();
        m_displayResolution = m_core.GetDisplayResolution();
        m_displaySize = m_core.GetDisplaySize();

        // Read Only Head Tracker Information.
        Matrix4x4 headPose = m_core.GetTrackerTargetPose(ZSCore.TrackerTargetType.Head);
        m_headPosition = new Vector3(headPose[0, 3], headPose[1, 3], headPose[2, 3]);
        m_headDirection = headPose * new Vector3(0, 0, 1.0f);

        Matrix4x4 headCameraPose = m_core.GetTrackerTargetCameraPose(ZSCore.TrackerTargetType.Head);
        m_headCameraPosition = new Vector3(headCameraPose[0, 3], headCameraPose[1, 3], headCameraPose[2, 3]);
        m_headCameraDirection = headCameraPose * new Vector3(0, 0, 1.0f);

        Matrix4x4 headWorldPose = m_core.GetTrackerTargetWorldPose(ZSCore.TrackerTargetType.Head);
        m_headWorldPosition = new Vector3(headWorldPose[0, 3], headWorldPose[1, 3], headWorldPose[2, 3]);
        m_headWorldDirection = headWorldPose * new Vector3(0, 0, 1.0f);

        // Read Only Stylus Tracker Information.
        Matrix4x4 stylusPose = m_core.GetTrackerTargetPose(ZSCore.TrackerTargetType.Primary);
        m_stylusPosition = new Vector3(stylusPose[0, 3], stylusPose[1, 3], stylusPose[2, 3]);
        m_stylusDirection = stylusPose * new Vector3(0, 0, 1.0f);

        Matrix4x4 stylusCameraPose = m_core.GetTrackerTargetCameraPose(ZSCore.TrackerTargetType.Primary);
        m_stylusCameraPosition = new Vector3(stylusCameraPose[0, 3], stylusCameraPose[1, 3], stylusCameraPose[2, 3]);
        m_stylusCameraDirection = stylusCameraPose * new Vector3(0, 0, 1.0f);

        Matrix4x4 stylusWorldPose = m_core.GetTrackerTargetWorldPose(ZSCore.TrackerTargetType.Primary);
        m_stylusWorldPosition = new Vector3(stylusWorldPose[0, 3], stylusWorldPose[1, 3], stylusWorldPose[2, 3]);
        m_stylusWorldDirection = stylusWorldPose * new Vector3(0, 0, 1.0f);

        bool isAnyStylusButtonPressed = false;

        for (int i = 0; i < m_core.GetNumTrackerTargetButtons(ZSCore.TrackerTargetType.Primary); ++i)
        {
          bool isButtonPressed = m_core.IsTrackerTargetButtonPressed(ZSCore.TrackerTargetType.Primary, i);

          if (i == 0)
        m_isStylusButton0Pressed = isButtonPressed;
          else if (i == 1)
        m_isStylusButton1Pressed = isButtonPressed;
          else if (i == 2)
        m_isStylusButton2Pressed = isButtonPressed;

          isAnyStylusButtonPressed |= isButtonPressed;
        }

        // Draw the stylus visualization
        float stylusBeamWidth = 0.0004f * m_worldScale;
        float stylusBeamLength = 0.1f * m_worldScale;

        if (m_stylusVisualizationObject != null)
        {
          LineRenderer lineRenderer = m_stylusVisualizationObject.GetComponent<LineRenderer>();
          lineRenderer.enabled = m_isStylusVisualizationEnabled;

          if (lineRenderer.enabled)
          {
        lineRenderer.SetWidth(stylusBeamWidth, stylusBeamWidth);
        lineRenderer.SetPosition(0, m_stylusWorldPosition);
        lineRenderer.SetPosition(1, (m_stylusWorldPosition + (stylusBeamLength * m_stylusWorldDirection)));

        if (!isAnyStylusButtonPressed)
        {
          lineRenderer.SetColors(Color.white, Color.white);
        }
        else
        {
          if (!m_wasAnyButtonPressed)
          {
            if (m_isStylusButton0Pressed)
              lineRenderer.SetColors(Color.red, Color.red);
            else if (m_isStylusButton1Pressed)
              lineRenderer.SetColors(Color.green, Color.green);
            else if (m_isStylusButton2Pressed)
              lineRenderer.SetColors(Color.blue, Color.blue);
          }
        }
          }
        }

        m_wasAnyButtonPressed = isAnyStylusButtonPressed;
    }
Пример #20
0
 // Use this for initialization
 void Start()
 {
     zs = GameObject.Find("ZSCore").GetComponent <ZSCore>();
 }
Пример #21
0
 void Start()
 {
     _core = GameObject.FindObjectOfType(typeof(ZSCore)) as ZSCore;
 }
Пример #22
0
 public TargetInfo(ZSCore core, ZSCore.TrackerTargetType type)
 {
     _core = core;
     _type = type;
 }
Пример #23
0
 public void Start()
 {
     _zsCore          = GameObject.Find("ZSCore").GetComponent <ZSCore> ();
     _zsCore.Updated += new ZSCore.CoreEventHandler(OnCoreUpdated);
     lr = GetComponent <LineRenderer> ();
 }
Пример #24
0
    // The Location on screen that the stylus is pointing to

    /*public Vector3 GetPointerLocation () {
     *      return _projectionPoint;
     *      }*/
    //The location on the screen that the Stylus is pointing to
    private void OnCoreUpdated(ZSCore sender)
    {
        UpdateStylusPose();
        UpdateProjectionPoint();
        DrawStylusBeam();
    }
Пример #25
0
 /// called by ZSCore after each input update.
 private void OnCoreUpdated(ZSCore sender)
 {
     UpdateStylusPose();
 }
Пример #26
0
 void Start()
 {
     _core = GameObject.FindObjectOfType(typeof(ZSCore)) as ZSCore;
     _stereoRig = GameObject.Find("ZSStereoRig");
 }
Пример #27
0
    protected override void OnScriptAwake()
    {
        base.OnScriptAwake();

        _core = GameObject.FindObjectOfType(typeof(ZSCore)) as ZSCore;
        _stylusSelector = GameObject.FindObjectOfType(typeof(ZSStylusSelector)) as ZSStylusSelector;
    }
Пример #28
0
 // Use this for initialization
 void Start()
 {
     zspace = GameObject.Find("/ZSCore").GetComponent<ZSCore>();
 }