Hi i try to create a Multimesh like a wall with size of (1,1,0.2) as a single mesh and use them to draw walls in different directions.

``````    var multiMesh = MultiMesh.new()
multiMesh.transform_format = MultiMesh.TRANSFORM_3D
multiMesh.mesh = CubeMesh.new()
multiMesh.mesh.size = Vector3(1,1,.2)
multiMesh.color_format = MultiMesh.COLOR_FLOAT
multiMesh.mesh.material = SpatialMaterial.new()
multiMesh.mesh.material.vertex_color_use_as_albedo = true
multiMesh.set_instance_count(4)
multiMesh.set_instance_color(0, Color.red)
multiMesh.set_instance_color(1, Color.blue)
multiMesh.set_instance_color(2, Color(.5,0,0,1))
multiMesh.set_instance_color(3, Color(0,0,.5, 1))

var mmi = MultiMeshInstance.new()
mmi.translate(Vector3(.5,.5,.1))
mmi.multimesh = multiMesh;

t0.origin = Vector3(0, 0, 0)
var t1 = Transform(b,Vector3(0, 0, 0) )
multiMesh.set_instance_transform(0, t0)
multiMesh.set_instance_transform(1, t1)
``````

The problem is original mesh position needs to fixed by mmi.translate(Vector3(.5,.5,.1)) to place the wall in the top line of the space (1,1)

When i try to reuse with the multimesh i apply the rotation related to the wall direction deg 0 for top horizontal
deg 90 for right vertical
deg 180 for bottom horizontal
deg 270 for left vertical

When i apply the transform to the mesh instance the mesh is wrong placed.
The picture shows the problem, on the left the blue wall is missplaced and should be placed like the example on the right side.

Looks like i need to set the center of the original mesh back to 0,5, 0.5 to get correct result.
The wall is just an example i have different mesh types.
What i doing wrong?

in Engine
edited

``````func set_instance_transform( meshIndex, origin:Vector3, degrees:int):