Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | theMX89 |
im using this script i wrote:
extends Spatial
func _ready():
var noise = OpenSimplexNoise.new()
noise.period = 80 <-------------------
noise.octaves = 6
var plane_mesh = PlaneMesh.new()
plane_mesh.size = Vector2(400,400)
plane_mesh.subdivide_depth = 200
plane_mesh.subdivide_width = 200
var surface_tool = SurfaceTool.new()
surface_tool.create_from(plane_mesh, 0)
var array_plane = surface_tool.commit()
var datatool = MeshDataTool.new()
datatool.create_from_surface(array_plane, 0)
for i in range(datatool.get_vertex_count()):
var vertex = datatool.get_vertex(i)
vertex.y = noise.get_noise_3d(vertex.x, vertex.y, vertex.z) * 60
datatool.set_vertex(i, vertex)
for i in range(array_plane.get_surface_count()):
array_plane.surface_remove(i)
datatool.commit_to_surface(array_plane)
surface_tool.begin(Mesh.PRIMITIVE_TRIANGLES)
surface_tool.create_from(array_plane, 0)
surface_tool.generate_normals()
var mesh_instance = MeshInstance.new()
mesh_instance.mesh = surface_tool.commit()
add_child(mesh_instance)
func _process(delta):
$Camera.rotate_y(delta * 0.5)
right at the begining there is the noise.period, whose value i want to replace by an random number, everytime i open the scene. can someone help?
i usually dont speak english, sorry if i spelled something wrong xD