void Start()
    {
        var direction = new Vector3(1, 1, 0);

        var maybe = WorldSphere.intersection(Vector3.zero, direction);

        if (maybe.valuePresent)
        {
            var intersection = maybe.get();

            Debug.Log("Intersection: (" + intersection.x + ", " + intersection.y + ", " + intersection.z + ")");
        }
    }
示例#2
0
    void Update()
    {
        var closeness = Warp.closenessFactor(transform.position, Facts.portalDisplayDistance);

        if (closeness == 0.0f)
        {
            portalTransform.gameObject.SetActive(false);

            return;
        }

        portalTransform.gameObject.SetActive(true);

        meshTransform.localScale           = Vector3.Lerp(minimumScale, maximumScale, closeness);
        meshTransform.transform.position   = WorldSphere.projectPoint(transform.position);
        cameraTransform.transform.position = Warp.warp(portalTransform.position, 0.0f);

        cameraTransform.transform.LookAt(DistanceFromCenter.center, Facts.up);
        meshTransform.transform.LookAt(DistanceFromCenter.center, Facts.up);

        meshTransform.Rotate(new Vector3(1.0f, 0.0f, 0.0f), 90.0f);
    }