Beispiel #1
0
    //TODO: Split into different files

    private void OnMouseUp()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            Transform objectHit = hit.transform;

            //Instantiate ( this.Cube, hit.point, Quaternion.identity );
            var point = hit.point;
            Debug.Log(point.y + ", " + (point.y - 0.2f * point.y));
            if (point.y > 1.4 && point.y < 1.93)
            {
                point.y -= 0.1f * point.y;
            }
            if (point.y > 1.93)
            {
                point.y -= 0.18f * point.y;
            }
            Vector3 p = new Vector3(point.x, point.y, point.z);


            SphericalCoord cs = CoordHelper.TransformToSphericalCoord(p, this.transform.position);

            Vector2 uv = CoordHelper.SphericalToUV(cs);

            ReadFromMap(uv);
        }
    }
Beispiel #2
0
    void FixedUpdate()
    {
        string s = "";

        s += string.Format("TRANSFORM (SPACE):            {0}\n", TargetObject.position);
        SphericalCoord sphereCoord = CoordHelper.TransformToSphericalCoord(TargetObject.position, ParentObject.position);

        s += string.Format("SPHERICAL COORDINATES:   {0}\n", sphereCoord.ToString());
        Vector2 uvCoord = CoordHelper.SphericalToUV(sphereCoord);

        s        += string.Format("UV COORDINATES:                    {0}\n", uvCoord.ToString());
        text.text = s;
    }
    void Update()
    {
        string s = "";

        s += string.Format("Transform: {0}\n", TargetObject.position);

        SphericalCoord sphereCoord = CoordHelper.TransformToSphericalCoord(TargetObject.position, ParentObject.position);

        s += string.Format("Spherical Coordinates: {0}\n", sphereCoord.ToString());

        Vector2 uvCoord = CoordHelper.SphericalToUV(sphereCoord);

        s += string.Format("Texture UV: {0}\n", uvCoord.ToString());

        text.text = s;
    }