Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Voxel perlin noise map generation HELP

Discussion in 'Scripting' started by Vexer, Jul 11, 2018.

  1. Vexer

    Vexer

    Joined:
    Feb 24, 2016
    Posts:
    186
    Hey guys i have been following some tutorials on how to create a voxel procedural map generator that someone uploaded about 2-3 years ago (so he doesn't respond anymore) the problem that iam having right now is that i would like to change my voxel(cube) sizes to 0.5 ints i have already accomplished that BUT! for some reason the spacing between the cubes is still a unity of 1 could someone please take a look at my code and tell me where iam doing something wrong? I would really appreciate that these are all my scripts:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using System;
    5. using System.Threading;
    6. using System.Collections.Generic;
    7. public class World : ILoopable
    8. {
    9.     private static World _instance = new World();
    10.     private Thread worldthread;
    11.     private bool IsRunning;
    12.     public static void Instantiate()
    13.     {
    14.         MainLoopable.GetInstance().RegisterLoopes(_instance);
    15.  
    16.  
    17.     }
    18.     public void OnApplicationQuit()
    19.     {
    20.         IsRunning = false;
    21.         Logger.Log("StoppingWorldthread");
    22.  
    23.     }
    24.     private bool RanOnce = false;
    25.     private Chunk[,] firstchunk = new Chunk[10, 10];
    26.     public void Start()
    27.     {
    28.         IsRunning = true;
    29.         worldthread = new Thread(() => {
    30.             Logger.Log("Initializing world thread");
    31.  
    32.             while (IsRunning)
    33.             {
    34.  
    35.                 try
    36.                 {
    37.  
    38.  
    39.                     if (!RanOnce)
    40.                     {
    41.                         RanOnce = true;
    42.                         for (int x = 0; x < 10; x++)
    43.                         {
    44.                             for (int z = 0; z < 10; z++)
    45.                             {
    46.                                 firstchunk[x, z] = new Chunk(x, z);
    47.                                 firstchunk[x, z].Start();
    48.                             }
    49.                         }
    50.  
    51.  
    52.  
    53.  
    54.                     }
    55.  
    56.                     for (int x = 0; x < 10; x++)
    57.                     {
    58.                         for (int z = 0; z < 10; z++)
    59.                         {
    60.  
    61.                             firstchunk[x, z].Update();
    62.                         }
    63.                     }
    64.  
    65.  
    66.                 }
    67.                 catch (System.Exception e)
    68.                 {
    69.                     UnityEngine.Debug.Log(e.StackTrace);
    70.                     Logger.Log(e);
    71.                 }
    72.             }
    73.             Logger.Log("World thread succesfully stopped");
    74.             Logger.MainLog.Update();// Rerun last log;
    75.  
    76.         });
    77.         worldthread.Start();
    78.     }
    79.  
    80.     public void Update()
    81.     {
    82.  
    83.         foreach (Chunk c in firstchunk)
    84.         {
    85.             c.OnUnityUpdate();
    86.  
    87.         }
    88.  
    89.  
    90.     }
    91. }
    92.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public interface ITickable {
    7.  
    8.     void Tick();
    9.     void Start();
    10.     void Update();
    11.     void OnUnityUpdate();
    12. }
    13.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public interface ILoopable
    7. {
    8.  
    9.     void Start();
    10.     void Update();
    11.  
    12.     void OnApplicationQuit();
    13. }
    14.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class DevChunk : Chunk {
    7.  
    8.     public DevChunk(int px, int pz) : base(px, pz){
    9.  
    10.     }
    11.  
    12.     public override void OnUnityUpdate()
    13.     {
    14.         if (HasGenerated && !HasRendered && HasDrawn)
    15.         {
    16.             base.OnUnityUpdate();
    17.             HasGenerated = false;
    18.             HasDrawn = false;
    19.             HasRendered = false;
    20.             Start();
    21.         }
    22.     }
    23. }
    24.  
    25.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using System;
    6.  
    7. public class MainLoopable : ILoopable {
    8.  
    9.     private static MainLoopable _Instance;
    10.  
    11.     private List<ILoopable> _RegisteredLoopes = new List<ILoopable>();
    12.  
    13.     public static MainLoopable GetInstance()
    14.     {
    15.         return _Instance;
    16.     }
    17.  
    18.     public static void Instantiate()
    19.     {
    20.         _Instance = new MainLoopable();
    21.         //register
    22.         Logger.Instantiate();
    23.         World.Instantiate();
    24.         //
    25.     }
    26.  
    27.     public void OnApplicationQuit()
    28.     {
    29.         foreach (ILoopable l in _RegisteredLoopes)
    30.         {
    31.             l.OnApplicationQuit();
    32.         }
    33.     }
    34.  
    35.     public void RegisterLoopes(ILoopable l)
    36.     {
    37.         _RegisteredLoopes.Add(l);
    38.     }
    39.  
    40.     public void DeRegisterLoopes(ILoopable i)
    41.     {
    42.         _RegisteredLoopes.Remove(i);
    43.     }
    44.  
    45.     public void Start()
    46.     {
    47.         foreach(ILoopable l in _RegisteredLoopes)
    48.         {
    49.             l.Start();
    50.         }
    51.     }
    52.  
    53.     public void Update()
    54.     {
    55.         foreach (ILoopable l in _RegisteredLoopes)
    56.         {
    57.             l.Update();
    58.         }
    59.     }
    60. }
    61.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEditor;
    6.  
    7. public class MeshData {
    8.  
    9.     private List<Vector3> _Verts = new List<Vector3>();
    10.     private List<int> _Tris = new List<int>();
    11.     private List<Vector2> _UVS = new List<Vector2>();
    12.  
    13.     public MeshData(List<Vector3> v,List<int> i,List<Vector2> u)
    14.     {
    15.         _Verts = v;
    16.         _Tris = i;
    17.         _UVS = u;
    18.     }
    19.  
    20.     public MeshData()
    21.     {
    22.  
    23.     }
    24.  
    25.     public void AddPos(Vector3 loc)
    26.     {
    27.         for(int i = 0; i < _Verts.Count; i++)
    28.         {
    29.             _Verts[i] = _Verts[i] + loc;
    30.         }
    31.     }
    32.  
    33.     public void Merge(MeshData m)
    34.     {
    35.         if(m._Verts.Count <= 0)
    36.         {
    37.             return;
    38.         }
    39.         if(_Verts.Count <= 0)
    40.         {
    41.             _Verts = m._Verts;
    42.             _Tris = m._Tris;
    43.             _UVS = m._UVS;
    44.             return;
    45.         }
    46.         int count = _Verts.Count;
    47.  
    48.         _Verts.AddRange(m._Verts);
    49.  
    50.         for (int i = 0; i < m._Tris.Count; i++)
    51.         {
    52.             _Tris.Add(m._Tris[i] + count);
    53.         }
    54.  
    55.         _UVS.AddRange(m._UVS);
    56.     }
    57.  
    58.     public Mesh ToMesh()
    59.     {
    60.         Mesh mesh = new Mesh();
    61.         mesh.vertices = _Verts.ToArray();
    62.         mesh.triangles = _Tris.ToArray();
    63.         mesh.uv = _UVS.ToArray();
    64.         mesh.RecalculateNormals();
    65.         mesh.RecalculateBounds();
    66.         MeshUtility.Optimize(mesh);
    67.         return mesh;
    68.     }
    69. }
    70.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class Cube : ITickable {
    7.  
    8.     private bool IsTransparent;
    9.     public static Cube Grass = new Cube(false);
    10.     public static Cube Air = new Cube(true);
    11.     public Cube(bool IsTransparent)
    12.     {
    13.         this.IsTransparent = IsTransparent;
    14.  
    15.     }
    16.     public bool Istransparent()
    17.     {
    18.         return IsTransparent;
    19.     }
    20.  
    21.     public void Start()
    22.     {
    23.  
    24.     }
    25.  
    26.     public void Tick()
    27.     {
    28.  
    29.     }
    30.  
    31.     public void Update()
    32.     {
    33.  
    34.     }
    35.  
    36.     public void OnUnityUpdate()
    37.     {
    38.  
    39.     }
    40.  
    41.     public virtual MeshData Draw(Chunk chunk, Cube[,,] _Cubes ,int x, int y,int z)
    42.     {
    43.         return MathHelper.DrawCube(chunk, _Cubes,this, x, y, z);
    44.     }
    45. }
    46.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class GameManager : MonoBehaviour {
    7.  
    8.     public float dx = 0.5f;
    9.     public float dz = 0.5f;
    10.     public float my = 0.5f;
    11.     public float cutoff = 0.5f;
    12.     public float mul = 0.5f;
    13.  
    14.     public static float Sdx = 1;
    15.     public static float Sdz = 1;
    16.     public static float Smy = 0.23f;
    17.     public static float Scutoff = 1.8f;
    18.     public static float Smul = 0.5f;
    19.  
    20.  
    21.     private MainLoopable main;
    22.     void Start () {
    23.         MainLoopable.Instantiate();
    24.         main = MainLoopable.GetInstance();
    25.         main.Start();
    26.     }
    27.    
    28.     void Update () {
    29.  
    30.         /*
    31.         Sdx = dx;
    32.         Sdz = dz;
    33.         Smy = my;
    34.         Scutoff = cutoff;
    35.         Smul = mul;
    36.  
    37.  
    38.     */
    39.         main.Update();
    40.     }
    41.  
    42.     void OnApplicationQuit()
    43.     {
    44.         main.OnApplicationQuit();
    45.     }
    46. }
    47.  
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class Chunk : ITickable{
    7.      public readonly int ChunkWidth = 20;
    8.      public readonly int ChunkHeight = 20;
    9.  
    10.     private Cube[,,] _Cubes;
    11.  
    12.     private int PosX;
    13.     private int Posz;
    14.     public Chunk(int px, int pz)
    15.     {
    16.         PosX = px;
    17.         Posz = pz;
    18.     }
    19.     protected bool HasGenerated = false;
    20.     public float GetHeight(float px, float pz, float py)
    21.     {
    22.         px += (PosX * ChunkWidth);
    23.         pz += (Posz * ChunkWidth);
    24.  
    25.         float p1 = Mathf.PerlinNoise(px / GameManager.Sdx, pz / GameManager.Sdz) * GameManager.Smul;
    26.         p1 *= (GameManager.Smy * py);
    27.         return p1;
    28.     }
    29.     public void Start()
    30.     {
    31.         _Cubes = new Cube[ChunkWidth, ChunkHeight, ChunkWidth];
    32.  
    33.         for(int x = 0; x<ChunkWidth; x++)
    34.         {
    35.             for (int y = 0; y < ChunkHeight; y++)
    36.             {
    37.                 for (int z = 0; z < ChunkWidth; z++)
    38.                 {
    39.                     float perlin = GetHeight(x, z, y);
    40.                     if (perlin > GameManager.Scutoff)
    41.                     {
    42.                         _Cubes[x, y, z] = Cube.Air;
    43.                     }
    44.                     else
    45.                     {
    46.                         _Cubes[x, y, z] = Cube.Grass;
    47.                     }
    48.                 }
    49.             }
    50.         }
    51.  
    52.         HasGenerated = true;
    53.  
    54.     }
    55.  
    56.     public void Tick()
    57.     {
    58.  
    59.     }
    60.  
    61.     protected bool HasDrawn = false;
    62.     private MeshData data;
    63.     protected bool DrawnLock = false;
    64.     public void Update()
    65.     {
    66.         if (!HasDrawn && HasGenerated && !DrawnLock)
    67.         {
    68.             DrawnLock = true;
    69.             data = new MeshData();
    70.             for (int x = 0; x < ChunkWidth; x++)
    71.             {
    72.                 for (int y = 0; y < ChunkHeight; y++)
    73.                 {
    74.                     for (int z = 0; z < ChunkWidth; z++)
    75.                     {
    76.                         data.Merge(_Cubes[x, y, z].Draw(this,_Cubes,x, y, z));
    77.                     }
    78.                 }
    79.             }
    80.             DrawnLock = false;
    81.             HasDrawn = true;
    82.         }
    83.     }
    84.     protected bool HasRendered = false;
    85.     private GameObject go;
    86.     public virtual void OnUnityUpdate()
    87.     {
    88.         if(HasGenerated && !HasRendered && HasDrawn)
    89.         {
    90.             HasRendered = true;
    91.             Mesh mesh = data.ToMesh();
    92.             if(go == null)
    93.             {
    94.                 go = new GameObject();
    95.             }
    96.  
    97.             Transform t = go.transform;
    98.  
    99.             if(t.gameObject.GetComponent<MeshFilter>() == null)
    100.             {
    101.                 t.gameObject.AddComponent<MeshFilter>();
    102.                 t.gameObject.AddComponent<MeshRenderer>();
    103.                 t.gameObject.AddComponent<MeshCollider>();
    104.                 t.gameObject.GetComponent<MeshRenderer>().material = Resources.Load<Material>("Grass");
    105.                 t.transform.position = new Vector3(PosX * ChunkWidth, 0, Posz * ChunkWidth);
    106.                 t.gameObject.layer = LayerMask.NameToLayer("Ground");
    107.             }
    108.  
    109.             t.transform.GetComponent<MeshFilter>().sharedMesh = mesh;
    110.             t.transform.GetComponent<MeshCollider>().sharedMesh = mesh;
    111.         }
    112.     }
    113. }
    114.  
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class MathHelper
    6. {
    7.  
    8.     public static MeshData DrawCube(Chunk chunk, Cube[,,] _Cubes, Cube cube, int x, int y, int z)
    9.     {
    10.  
    11.  
    12.         MeshData d = new MeshData();
    13.         if (cube.Equals(Cube.Air))
    14.         {
    15.             return new MeshData();
    16.  
    17.         }
    18.  
    19.  
    20.  
    21.         if (y - 1 <= 0 || _Cubes[x, y - 1, z].Istransparent())
    22.         {
    23.             d.Merge(new MeshData( // Bottom Face
    24.         new System.Collections.Generic.List<Vector3>() {
    25.             new Vector3(0,0,0),
    26.             new Vector3(0,0,0.5f),
    27.             new Vector3(0.5f,0,0),
    28.             new Vector3(0.5f,0,0.5f)
    29.         },
    30.         new System.Collections.Generic.List<int>() {
    31.                  0,2,1   ,3,1,2
    32.         },
    33.         new System.Collections.Generic.List<Vector2>() {
    34.                 new Vector2(0,0),
    35.                 new Vector2(0,0.5f),
    36.                 new Vector2(0.5f,0),
    37.                 new Vector2(0.5f,0.5f),
    38.  
    39.  
    40.             }));
    41.         }
    42.  
    43.         if (y + 1 >= chunk.ChunkHeight || _Cubes[x, y + 1, z].Istransparent())
    44.         {
    45.             d.Merge(new MeshData( // Top Face
    46.           new System.Collections.Generic.List<Vector3>() {
    47.             new Vector3(0,0.5f,0),
    48.             new Vector3(0,0.5f,0.5f),
    49.             new Vector3(0.5f,0.5f,0),
    50.             new Vector3(0.5f,0.5f,0.5f)
    51.            },
    52.            new System.Collections.Generic.List<int>() {
    53.                  0,1,2,3,2,1
    54.            },
    55.             new System.Collections.Generic.List<Vector2>() {
    56.                 new Vector2(0,0),
    57.                 new Vector2(0,0.5f),
    58.                 new Vector2(0.5f,0),
    59.                 new Vector2(0.5f,0.5f),
    60.  
    61.  
    62.              }));
    63.         }
    64.  
    65.  
    66.  
    67.         if (x + 1 >= chunk.ChunkWidth || _Cubes[x + 1, y, z].Istransparent())
    68.         {
    69.             d.Merge(new MeshData( // Back Face
    70.           new System.Collections.Generic.List<Vector3>() {
    71.             new Vector3(0.5f,0,0),
    72.             new Vector3(0.5f,0,0.5f),
    73.             new Vector3(0.5f,0.5f,0),
    74.             new Vector3(0.5f,0.5f,0.5f)
    75.            },
    76.            new System.Collections.Generic.List<int>() {
    77.                  0,2,1,3,1,2
    78.            },
    79.             new System.Collections.Generic.List<Vector2>() {
    80.                 new Vector2(0,0),
    81.                 new Vector2(0,0.5f),
    82.                 new Vector2(0.5f,0),
    83.                 new Vector2(0.5f,0.5f),
    84.  
    85.  
    86.              }));
    87.  
    88.         }
    89.  
    90.         if (x - 1 <= 0 || _Cubes[x - 1, y, z].Istransparent())
    91.         {
    92.             d.Merge(new MeshData( // Front Face
    93.          new System.Collections.Generic.List<Vector3>() {
    94.             new Vector3(0,0,0),
    95.             new Vector3(0,0,0.5f),
    96.             new Vector3(0,0.5f,0),
    97.             new Vector3(0,0.5f,0.5f)
    98.           },
    99.           new System.Collections.Generic.List<int>() {
    100.                  0,1,2,3,2,1
    101.           },
    102.            new System.Collections.Generic.List<Vector2>() {
    103.                 new Vector2(0,0),
    104.                 new Vector2(0,0.5f),
    105.                 new Vector2(0.5f,0),
    106.                 new Vector2(0.5f,0.5f),
    107.  
    108.  
    109.              }));
    110.         }
    111.         if (z + 1 >= chunk.ChunkWidth || _Cubes[x, y, z + 1].Istransparent())
    112.         {
    113.             d.Merge(new MeshData( // Right Face
    114.           new System.Collections.Generic.List<Vector3>() {
    115.             new Vector3(0,0,0.5f),
    116.             new Vector3(0.5f,0,0.5f),
    117.             new Vector3(0,0.5f,0.5f),
    118.             new Vector3(0.5f,0.5f,0.5f)
    119.            },
    120.            new System.Collections.Generic.List<int>() {
    121.                  0,1,2,3,2,1
    122.            },
    123.             new System.Collections.Generic.List<Vector2>() {
    124.                 new Vector2(0,0),
    125.                 new Vector2(0,0.5f),
    126.                 new Vector2(0.5f,0),
    127.                 new Vector2(0.5f,0.5f),
    128.  
    129.  
    130.              }));
    131.         }
    132.         if (z - 1 <= 0 || _Cubes[x, y, z - 1].Istransparent())
    133.         {
    134.             d.Merge(new MeshData( // Left Face
    135.          new System.Collections.Generic.List<Vector3>() {
    136.             new Vector3(0,0,0),
    137.             new Vector3(0.5f,0,0),
    138.             new Vector3(0,0.5f,0),
    139.             new Vector3(0.5f,0.5f,0)
    140.          },
    141.          new System.Collections.Generic.List<int>() {
    142.                  0,2,1    ,3,1,2
    143.          },
    144.          new System.Collections.Generic.List<Vector2>() {
    145.                 new Vector2(0,0),
    146.                 new Vector2(0,0.5f),
    147.                 new Vector2(0.5f,0),
    148.                 new Vector2(0.5f,0.5f),
    149.  
    150.  
    151.             }));
    152.  
    153.         }
    154.  
    155.         d.AddPos(new Vector3(x - 0.5f, y - 0.5f, z - 0.5f));
    156.  
    157.         return d;
    158.     }
    159. }
    160.  
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4. using UnityEditor;
    5.  
    6. [RequireComponent(typeof(MeshFilter))]
    7. [RequireComponent(typeof(MeshRenderer))]
    8. public class MapGenerator : MonoBehaviour
    9. {
    10.     void Start()
    11.     {
    12.         CreateCube();
    13.  
    14.     }
    15.  
    16.     private void CreateCube()
    17.     {
    18.  
    19.         Vector3[] vertices = {
    20.             new Vector3 (0, 0, 0),
    21.             new Vector3 (0.5f, 0, 0),
    22.             new Vector3 (0.5f, 0.5f, 0),
    23.             new Vector3 (0, 0.5f, 0),
    24.             new Vector3 (0, 0.5f, 0.5f),
    25.             new Vector3 (0.5f, 0.5f, 0.5f),
    26.             new Vector3 (0.5f, 0, 0.5f),
    27.             new Vector3 (0, 0, 0.5f),
    28.         };
    29.  
    30.         int[] triangles = {
    31.          0, 2, 1, //face front
    32.          0, 3, 2,
    33.          2, 3, 4, //face top
    34.          2, 4, 5,
    35.          1, 2, 5, //face right
    36.          1, 5, 6,
    37.          0, 7, 4, //face left
    38.          0, 4, 3,
    39.          5, 4, 7, //face back
    40.          5, 7, 6,
    41.          0, 6, 7, //face bottom
    42.          0, 1, 6
    43.          };
    44.  
    45.         Mesh mesh = GetComponent<MeshFilter>().mesh;
    46.         mesh.Clear();
    47.         mesh.vertices = vertices;
    48.         mesh.triangles = triangles;
    49.         this.GetComponent<Renderer>().material.color = Color.green;
    50.         MeshUtility.Optimize(mesh);
    51.         mesh.RecalculateNormals();
    52.     }
    53. }
    54.  
     
  2. Vexer

    Vexer

    Joined:
    Feb 24, 2016
    Posts:
    186
    I think it has something to do with the mathhelper class with these lines of code example:
    Code (csharp):
    1.  
    2. if (x + 1 >= chunk.ChunkWidth || _Cubes[x + 1, y, z].Istransparent())
    3.        {
    4.  
    [*]But i don't know how i could change the 1 values to 0.5 because it needs a int but 0.5 is not a int and i don't know how to implement floats..
     
  3. CubicCBridger

    CubicCBridger

    Joined:
    Apr 19, 2017
    Posts:
    44
    try changing all the

    Code (CSharp):
    1. if (x + 1 >= chunk.ChunkWidth || _Cubes[x + 1, y, z].Istransparent())
    to

    Code (CSharp):
    1. if (x + 0.5 >= (float)chunk.ChunkWidth || _Cubes[x + 1, y, z].Istransparent())
    you will have to do the same for y and z values in that function. <- This doesn't guarantee that my suggested solution will actually work (although I think it MIGHT, it's not very much effort to try it out), but it probably should have been one of the first things you tried before asking for people to spend their time going over your code as it is a low effort tweak.

    If you already have tried it out, it doesn't hurt to add in your attempts of how you tried to solve your problem so we know you aren't just asking us to do your work for you and then can eliminate writing out useless responses.

    In another note:

    Code (CSharp):
    1. _Cubes[x,y,z]
    is just a multi-dimensional array, so you will never be able to index with a float, as asking for the cube at index 0.5,y,z will never make any sense in any context. Asking for a zero point anything item from a collection of items doesn't make sense (e.g what's the third and half ball from a bag of balls? The size of the ball doesn't effect the nonsensical query)

    To me, this kind of question indicates you weren't attempting to understand the tutorial and were just copy pasting the code / files / etc rather than understanding what it actually does, unless the tutorial told you too, in which case it isn't a very good tutorial.

    Why do you want to half the size anyway? i.e why not just double the size of whatever you're putting in, in comparison to the map, it would have the exact same effect without needing to adjust this code (if you don't understand how to adjust this code).
     
  4. Vexer

    Vexer

    Joined:
    Feb 24, 2016
    Posts:
    186
    changing the 1 value to 0.5 makes it draw nothing, the reason why i want my cubes to be 0.5 is because that's what i want my game style to be
     
  5. Vexer

    Vexer

    Joined:
    Feb 24, 2016
    Posts:
    186
    And yes i understand that i can't put a float into a multi-dimensional array that's why i'm here im asking what else i can change it to so i can put floats in there