I'm working on a reverse-engineering tool, it extracts maps from a game, and the game actually stores the positions of objects instances using Matrices4x4 transformation.
I would like to know how I can apply a transform to an object or to a group of objects. The best would be to make it work with my current code, of course, but in any case I can still rewrite some stuff, doesn't matters.
myMatrix = mathutils.Matrix(
(0.0, 1.254, 68.14, 0.0),
(0.01546, 1.254, 204.85468, 0.0),
(0.45, 0.0, 0.0, 0.0),
(204.154, 451.943, 345.456, 1.0)
)
name = 0
myCollection = bpy.data.collections.new("Custom Collection")
for i in range(randint(10, 200))
verts = [] # Just imagine that there's a list of vertices tuple.
faces = [] # Same, imagine there's a list of faces tuple.
edges = [] # Empty. Ignore it
meshdata = bpy.data.meshes.new(f"MyObjData_{str(name)}")
meshdata.from_pydata(verts, edges, faces)
obj = bpy.data.objects.new(name=f"MyObj_{str(name)}", object_data=meshdata)
myCollection.objects.link(obj)
# How do I set the position of my object using the matrix myMatrix ?
meshdata.transform(myMatrix)
$\endgroup$meshdata.transform(tie_instance_matrix) TypeError: Mesh.transform(): error with argument 1, "matrix" - expected sequence items of type float, not Vector
$\endgroup$