0 votes

I need to retrieve a list of all of the vertices which are transformed by any given blend shape. To do this, I'm applying the blend shapes and keeping track of which vertices changed. However, it seems like global_transform.xform() just returns a vertex position from the base mesh, without taking blend shapes into account. Here's a simplified version of my code in case I'm doing something wrong:

func _ready():
    var MDT = MeshDataTool.new()
    MDT.create_from_surface(mesh, 0)
    var old_verts = []
    var new_verts = []
    for v in MDT.get_vertex_count():
    set_blend_shape("Blend Shape 1", 1) # this function just sets a blend shape's value
    for v in MDT.get_vertex_count():
    for v in old_verts.size():
        if old_verts[v] != new_verts[v]:
            print("!") # this never happens, so old_verts must be identical to new_verts
Godot version 3.3.stable
in Engine by (12 points)

1 Answer

0 votes

You need to reference the mesh in question. Try mesh.set("blend_shapes/blend_shape_1", 1) instead of set_blend_shape. Also, remove the spaces in the name, that's asking for trouble.

Let me know if it works.

by (2,152 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.