![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | spepe |
Hello!
I have this code:
func _ready():
var mesh = []
var planemesh = PlaneMesh.new()
planemesh.surface_set_material(0, SpatialMaterial.new())
var m = 32
for a in range(0,m):
mesh.append(MeshInstance.new())
mesh[a].set_mesh(planemesh)
mesh[a].set_script(preload("res://MeshInstance.gd"))
add_child(mesh[a])
for a in range(0,m):
mesh[a].translate(Vector3((a*32)-16,0,(a*32)-16 ))
pass # Replace with function body.
I want to generate geometry. But when the MeshInstance is inserted into the scene then I get an error about the MeshInstance missing a Mesh and a Surface on that Mesh.
In the MeshInstance.gd above I set up the MeshInstances ready function to set a texture based on the MeshInstance’s position.
Hi,
your code runs fine here. What does “res://MeshInstance.gd” does?
klaas | 2020-07-23 17:37