- Edited
I'm doing a tutorial on multimeshes but it was made in Godot 3.5 and no matter what I try I can't get this one line translated from 3 to 4. (Important note: I have never gotten a multimesh to work before, ever; I'm still new at this.) The line in the tutorial, which happens during a for loop, iterating through all the transforms, is this...
self.multimesh.set_instance_transform(index, Transform(Basis(), pos)
...where index is the current mesh instance and pos is a Vector3 of the mesh's position.
But in Godot 4 there are only TWO arguments in set_instance_transform, so I'm lost. The only attempt that didn't throw an inexpicable error was when I changed it to...
self.multimesh.set_instance_transform(index, pos)
but it just puts every mesh at the origin, on top of each other, not where they're supposed to go.
Any help would be appreciated, thanks!
P.S. Here's the entire function for reference:
`func generate_sphere():
var cube_size = 1
var cube_half_size = cube_size / 2.0
var origin_distance = cubes_per_side * cube_half_size - cube_half_size
var origin = -Vector3(origin_distance,origin_distance,origin_distance)
var index = 0
for x in range(cubes_per_side):
for y in range(cubes_per_side):
for z in range(cubes_per_side):
var pos = origin + Vector3(x * cube_size, y * cube_size, z * cube_size)
self.multimesh.set_instance_transform(index, Transform(Basis(), pos)
index += 1`