# Wrapping 2d game map using 3d noise

Posts: 20Member
edited December 2019

I'm trying to make a map that loops along the x axis, like the maps of civilization. I'm using 3d noise moving linearly along the X axis, then using the parametric equation to get a Y and Z coordinate whose value I use for the Y coordinate of the 2d map. This is successful in getting a random map, however it is not wrapping. Below are examples of what I mean. Any ideas as to why this is happening and how to correct it are welcome.

Here's the code:

export var numCol = 130
export var numRow = 60
export var globeRadius = 25.0
var angleStep = deg2rad(360.0 / numCol)

func generate_map()
var currentAngle
for x in numCol:
currentAngle = 0.0
for y in numRow:
hexNode[x][y].elevation = noiseMap.get_noise_3d(x, globeRadius * sin(currentAngle), globeRadius * cos(currentAngle))
currentAngle += angleStep

FIXED

Solution: With the code I had, it was set to wrap along the Z axis if I use numRow to calculate angleStep

Tags :