Beispiel #1
0
    /*
     * Checks if user choosed to walk on the specified path.
     * */
    private bool isPathChosen(VirtualPath path)
    {
        int direction = getRedirectionDirection(currentJoint, path.getCurve());
        int pathIndex = data.getPathIndex(currentJoint, path.getCurve());

        Vector3 directionToCurveCircleCenter = (path.getCurve().getCircleCenter() - currentJoint.getWalkingStartPosition(pathIndex)).normalized;
        Vector3 rotatedDirectionVector       = Quaternion.AngleAxis(-direction * 90f, Vector3.up) * directionToCurveCircleCenter;
        Plane   plane = new Plane(rotatedDirectionVector.normalized, currentJoint.getWalkingStartPosition(pathIndex));

        if (plane.GetSide(Camera.main.transform.localPosition))
        {
            return(true);
        }
        return(false);
    }
Beispiel #2
0
 /*
  * Starts redirection on the specified path.
  * Sets current path and current curve as well as the redirection direction.
  * */
 private void startRedirection(VirtualPath path)
 {
     currentCurve         = path.getCurve();
     currentPath          = path;
     redirectionDirection = this.getRedirectionDirection(currentJoint, currentCurve);
     redirectionStarted   = true;
     Debug.Log("Redirection started with target: " + currentPath.getOtherIntersection(currentIntersection).getLabel());
 }