Beispiel #1
0
    /*
     * public static Vector3 blockPosToWorldPos(Int3 size, Int3 blockPos, float scale) {
     *      //y coordinate is diffrent. y = 0 is bottom.
     *      return (new Vector3(-size.x, 0f,-size.z) / 2f + blockPos.ToVec3 () + new Vector3(0.5f,0.5f,0.5f)) * scale;
     * }
     * public static Vector3 blockPosToWorldPos(Int3 size, Vector3 blockPos, float scale) {
     *      return (new Vector3(-size.x,0f,-size.z) /2f + blockPos + new Vector3(0.5f,0.5f,0.5f)) * scale;
     * }
     * public static Int3 WorldPosToblockpos(Int3 size, Vector3 worldPos, float scale) {
     *      return new Int3 (worldPos/scale - new Vector3 (0.5f, 0.5f, 0.5f) + new Vector3(size.x, 0f, size.z) / 2f);
     * }*/

    public static Vector3 blockPosToWorldPos(Int3 size, Int3 blockPos, float scale)
    {
        //y coordinate is diffrent. y = 0 is bottom.
        return((new Vector3(-size.x, -size.y, -size.z) / 2f + blockPos.ToVec3() + new Vector3(0.5f, 0.5f, 0.5f)) * scale);
    }