private void grabbingPoint(Transform point, ConstraintGrabbable grabber)
        {
            Vector3 newLoc = Vector3.zero;

            if (!(FixedPlane))//&& presentPlane.forwardPlane.GetComponent<MeshRenderer>().enabled))
            {
                FixedPlane = false;
                lockButton.LockOff();
                newLoc = grabber.lastLocalPos;
                point.localPosition = newLoc;

                if (ptManager != null)
                {
                    ptManager.updatePoint(point.name, presentPlane.UnscaledPoint(newLoc), FixedPlane);
                }
                else
                {
                    ptManager2D.updatePoint(point.name, presentPlane.UnscaledPoint(newLoc), FixedPlane);
                }
            }
        }
Exemplo n.º 2
0
        private void grabbingPoint(Transform point, ConstraintGrabbable grabber)
        {
            Vector3 newLoc = Vector3.zero;

            if (FixedPlane && presentPlane.forwardPlane.GetComponent <MeshRenderer>().enabled)
            {
                newLoc = Vector3.ProjectOnPlane(grabber.lastLocalPos - presentPlane.centerPt.localPosition, presentPlane.lookAtTarget.localPosition - presentPlane.plane.localPosition);
                newLoc = newLoc + presentPlane.centerPt.localPosition;
                if (newLoc.x > 10 || newLoc.x < -10 || newLoc.y > 10 || newLoc.y < -10 || newLoc.z > 10 || newLoc.z < -10)
                {
                    grabber.transform.position = point.position;
                }
                point.localPosition = newLoc;
            }
            else
            {
                FixedPlane = false;
                lockButton.LockOff();
                newLoc = grabber.lastLocalPos;
                point.localPosition = newLoc;
            }
            ptManager.updatePoint(point.name, presentPlane.UnscaledPoint(newLoc), FixedPlane);
        }