Please help me morph a region of mesh

I’m having trouble morphing a region of a mesh. I have a mesh with lots of vertices and contours. I would like to translate a set of pre-defined vertices along a vector by using a slider.

For example:

  1. Start with a bunny - assuming a height of 10 (lets say the ears start at a height of 5)
  2. Select (pre-defined, not dynamically with gizmos or RMB) the upper half of ears (all vertices above a height of 7.5)
  3. Move them upward on a slider

Here’s a non morph working solution (I’ve hard coded the height for now).

I loop through the indices, look for positions above a value, and change them if found.
There must be a better way than always looping through all positions?


1 Like

Hello and welcome to the forum,

This is all what morph targets are for Morph Targets | Babylon.js Documentation

It assumes you know to list of vertices to move around.


Thanks for the welcome and direction.

I’ll dig into that a bit more. I used the update vertex docs (below) initially but that was for a simple box.


I’m still having trouble morphing a subset of vertices. The examples and docs only show whole meshes, not regions. I’ll keep at it.


1 Like

Here is an example of doing it with skeleton rigging, LOL lets get that bunny’s ears extending! :grin: :beers:


I appreciate you working out an example. It looks great! I haven’t played with skeleton rigging at all.
I’ll play with this a bit.

I’ll look into the differences between skeleton vs morphing.

Thank you!


To Morph I need to have a target. To create the target I have imported the bunny and updated the ear positions. PG here

Next will be to import the original mesh (or make a copy), tie it to the morph target, and connect the influence with a slider?

Latest PG here. I have morphed a bunny!!!

but I cannot hook it up to the slider because I can’t seem to access my dictionary (or array) of meshes outside of the onSuccess functions - for some reason “myMeshes” shows “bunny” as a key but "myMeshes[“bunny”] is null and won’t allow me to work on it! Any idea?

console.log(myMeshes['bunny']) in the slider.onValueChangedObservable callback does display something, not null, for me.

WOAH! Thanks for checking. That’s what I would expect except for me it is undefined!

Actually my console.log in the slider does display something. It’s the global space (say right before return scene) that shows “myMeshes” as a dictionary with “bunny” and “morphedBunny” but “myMeshes[‘bunny’]” as undefined. I’m confused.

also, target0.influence doesn’t return an error but it doesn’t work either!


is the mesh not updateable? do imported meshes require additional settings to get the influence working?

Can you save your playground and share it with me? I’m going to try and do this outside of the playground.

Does the slider actually modify the influence and update the mesh as I THINK it should based on the code that’s there?

console.log(value, target0.influence) yields value (slider works find) and 0 (influence parameter not updated… so why is that?)

and by the way, when using the inspector, “bunny” shows up with “morphedBunny” as a target adn the influence slider in the inspector works!!!


You wrote target0.infuence and not target0.influence:

Also, you don’t need to set the vertices updatable (I have commented this code).

1 Like


I was moving frantically after all this work. Thank you so much!