I’m trying to import Blender animations to my own game engine.
Since I’m facing some troubles I decided to skin a mesh “manually” inside Blender through the python API as a test, but I can’t even get that to work.
What’s wrong here ?
for vertex in duplicate.data.vertices:
new_position = mathutils.Vector((0,0,0))
for group in vertex.groups:
group_name = duplicate.vertex_groups[group.group].name
bone = armature.pose.bones[group_name]
new_position += (bone.matrix.copy() @ vertex.co.copy()) * group.weight
vertex.co = new_position