Child objects and shape keys

Hi everyone,
I have this object inside Blender with a shape key.
p1
The shape key is working in three.js correctly so I can manipulate it with morphTargetInfluences .

What I want is to place an object on the very top that follow it when the shape key change .

  • I was thinking of adding the top vertices to a vertex group, then in three.js get their world position and create and add the child object to the scene with these coordinate. But I didn’t figure out how to get the vertex group world position in three.js.
  • Another option is to make the center of object inside Blender the top vertices and add the child object there but it seem that it dosen’t work very well with shape keys .

Any idea on how this can be done is welcome.

Thanks .

I think I would pick one of the top vertices and just compute the respective morph target animation per frame. For performance reasons this type of vertex displacement happen on the GPU but you can implement the same logic on the CPU via JavaScript. If you just animate a single vertex, there should be no performance problem.

You can then use the animated vertex as the new position for your mentioned object.

1 Like

thanks for taking time for this .
i have resolved the issue differently .
instead of adding the child object to the main one , i have added it to the scene :stuck_out_tongue:
then by manipulating it’s position and the shape key of the main object i get the desired behaviour .
it’s not an ideal solution but at least it work !

1 Like