Can't animate WEBGL model in draw loop


I’m loading 2 objs files with loadModel. Both objs have the same vert count, and because of this I’m trying to animate the verts to lerp from one model onto the other in the draw loop.

I have direct access to the model’s vertices so I’m editing their values to do this. Any changes to the vertices are only reflected on the first frame then have no effect on the model beyond that. Do I have a call a method or something to refresh the model to update to its current vertex values?

Here’s a simple example where I edit a vertex, and it only works on frame 0.

Actually it’s not officially supported :frowning:


Thanks that got me a bit closer. I’m able to animate the mesh but for some reason I can’t seem to clear drawing of the original model.

I’m trying to check out the source code for p5.Geometry for anything to refresh it but don’t see anything useful.

There we go, this hack seems to do it!

You need to set a few properties from the model to its dirtyFlags. This seems to trigger it to clear and redraw. Let me know if I can optimize it in any way!

1 Like

Here’s a test blending through multiple models to drive its jaw :slight_smile: