How to clone a VRM model? #1172
Unanswered
mattrossman
asked this question in
Help
Replies: 5 comments 3 replies
-
Cloning the entire VRM! I have never thought of it. What is your purpose here? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Any updates? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Three.js you can reuse glTF models by cloning them prior to adding them to the scene. Adding multiple copies of the same
gltf.scene
instance can otherwise lead to unexpected behavior.For simple models this can be accomplished via
gltf.scene.clone()
. For models with skinned meshes, more care must be taken to clone internal objects. In these cases, you may clone the model usingSkeletonUtils
fromthree/examples
:See discussion: https://discourse.threejs.org/t/how-to-clone-a-model-thats-loaded-with-gltfloader/23723/8
As VRM is an extension of glTF, I expect to be able to clone VRM models in a similar way as regular glTF models. However, while I can clone the
gltf.scene
withSkeletonUtils.clone()
as shown above, this doesn't clone theVRM
object associated with it, so I lose out on VRM functionality.Example code: https://jsfiddle.net/mattrossman/satvh5kr/3/
As you can see in the example, I can clone and reposition the model, but I don't have a
VRM
object for the copy.Is there a suggested way to fully clone VRM models? I see a VRMHumanoid.clone() method in the API reference, but I'm not sure if/how it would be used here.
Beta Was this translation helpful? Give feedback.
All reactions