I saw on the github examples a few very interesting demos that use morph targets to alter the vertex position of an instanced mesh.
In those cases primitives such as a sphere or a cylinder were used and I was able to replicate the experiment: what I can’t seem to be able to do is to use the same morphtargets with an imported 3D model.
Is this possible at all?
Thank you in advance!
It should work, but there could be some bugs / issues.
Could you please try and disable the hierarchy import in Settings->Asset settings and see if that works for you?
Alternatively are you able to share some simple project with fbx with morph targets?
Other option would be to load it as glb (export glb with morph targets from your 3d app), load that and use that at runtime.
And report back please, if there are some issues, we’d like to fix them.
Thank you for you very quick and helpful response, I do believe it should work and it’s surely my error.
Regardless, I managed to make the other demo (PlayCanvas Examples ) work for me and this is actually already pretty good.
Using this demo as a reference, one should be able to use morph targets on a fbx, I’ll try again.
Sorry to take advantage of your kindness but basically what I want to achieve is to make the faces of the model (all separated from each other) explode upward: so instead of a fluid animation where the faces stay together, they should separate and scatter. Do you think this is doable?
If you need faces to fly separately, you might need to process the mesh. In general, each vertex is stored exactly one time, which is indexed by the index buffer. What you need is for each face to have a unique set of vertices for itself, so when you move it, it only moves for this one face, and not other faces that share it.
This example gets positions from existing model: PlayCanvas Examples
You might need to do something similar … but get positions, normals, uvs and indices, and based on the index buffer generate new list of positions, normals and uvs which are unique per face. And create meshes based on those. Should be not many lines. You can use this to build a new mesh, and then new mesh instance and assign it to your render component https://github.com/playcanvas/engine/blob/04f4e80425de7dc1cd2a80b6e36881a385717c88/src/scene/procedural.js#L209-L276