Exemplo n.º 1
0
 protected virtual void DrawPlayAreaExtensions()
 {
     if (IS_NOT_NULL(myLineRenderer))
     {
         Vector3[] positions = ExtentPoints.ToArray();
         myLineRenderer.positionCount = positions.Length;
         myLineRenderer.SetPositions(positions);
     }
 }
Exemplo n.º 2
0
        public override void SetUpPlayArea()
        {
            if (IS_NOT_NULL(ARCursor.Instance))
            {
                // Reset (existing) BAnchors
                setAnchorsCount = 0;
                PlayAreaBAnchor[] playAreaBAnchorsCopy = PlayAreaBAnchors.ToArray();
                foreach (PlayAreaBAnchor playAreaBAnchor in playAreaBAnchorsCopy)
                {
                    Destroy(playAreaBAnchor.gameObject);
                }
                PlayAreaBAnchors.Clear();
                ExtentPoints.Clear();
                CurrentPlayAreaBAnchorBeingPlaced = null;
                DrawPlayAreaExtensions();

                LogConsole("Started setting up play area. Setting first anchor...");
                PlayAreaState = EPlayAreaState.SETTING_ANCHORS;
                StartSettingFirstAnchor();
            }
        }
Exemplo n.º 3
0
        protected override void SetExtentPoints()
        {
            if (setAnchorsCount > 0 &&
                PlayAreaState == EPlayAreaState.SETTING_ANCHORS &&
                ARE_EQUAL(PlayAreaBAnchors.Count, 2))
            {
                //Vector3 firstAnchorPosition = BUtils.Get3DPlanearVector(playAreaBAnchors[0].GetPosition());
                Vector3 firstAnchorPosition = PlayAreaBAnchors[0].GetPosition();
                Vector3 firstAnchorForward  = PlayAreaBAnchors[0].transform.forward;
                Vector3 firstAnchorRight    = PlayAreaBAnchors[0].transform.right;

                //Vector3 SecondAnchorPosition = BUtils.Get3DPlanearVector(playAreaBAnchors[1].GetPosition());
                Vector3 SecondAnchorPosition = PlayAreaBAnchors[1].GetPosition();
                SecondAnchorPosition = new Vector3(SecondAnchorPosition.x, firstAnchorPosition.y, SecondAnchorPosition.z);
                Vector3 SecondAnchorForward = PlayAreaBAnchors[1].transform.forward;
                Vector3 SecondAnchorRight   = PlayAreaBAnchors[1].transform.right;

                Vector3 firstIntersectionPoint;
                Math3D.LineLineIntersection(out firstIntersectionPoint, firstAnchorPosition, firstAnchorForward, SecondAnchorPosition, SecondAnchorRight);
                //if (Math3D.LineLineIntersection(out firstIntersectionPoint, firstAnchorPosition, firstAnchorForward, SecondAnchorPosition, SecondAnchorRight) == false)
                //{
                //    Vector3 closestPoint1;
                //    Vector3 closestPoint2;
                //    Math3D.ClosestPointsOnTwoLines(out closestPoint1, )
                //}

                Vector3 secondIntersectionPoint;
                Math3D.LineLineIntersection(out secondIntersectionPoint, firstAnchorPosition, firstAnchorRight, SecondAnchorPosition, SecondAnchorForward);

                ExtentPoints.Clear();
                ExtentPoints.Add(firstAnchorPosition);
                ExtentPoints.Add(firstIntersectionPoint);
                ExtentPoints.Add(SecondAnchorPosition);
                ExtentPoints.Add(secondIntersectionPoint);
            }
        }