Hello, I’m working on a minecraft clone, I’ve run into a problem, When i place a block down, The texture doesn’t appear till i break a block somewhere in the world, as soon as i break the block, The texture of the blocks updates itself then it appears.
The Scripts I’m using
if (Input.GetKey(KeyCode.Mouse1))
{
RaycastHit hit;
Ray ray = Camera.mainCamera.ScreenPointToRay(new Vector3(Screen.width / 2.0f, Screen.height / 2.0f, 0));
if (Physics.Raycast(ray, out hit, 4.0f))
{
Data.SetBlockType((int) hit.point.x, (int) hit.point.z, (int) hit.point.y, BlockType.Grass);
World.RegenerateChunks();
ProcessChunksAtOnce = true;
}
}
if (Input.GetKey(KeyCode.Mouse0))
{
RaycastHit hit;
Ray ray = Camera.mainCamera.ScreenPointToRay(new Vector3(Screen.width / 2.0f, Screen.height / 2.0f, 0));
if (Physics.Raycast(ray, out hit, 4.0f))
{
Vector3 hitPoint = hit.point + (ray.direction.normalized * 0.01f);
IntVect blockHitPoint = new IntVect((int)hitPoint.x, (int)hitPoint.z, (int)hitPoint.y);
World.Dig(blockHitPoint, hitPoint);
Any help would be greatly Appreciated.