it would be really cool to be able to play animations from one 3D (glb) model on another 3D model. I have a humanoid glb with some neat animations, but it’s ugly. On the other side, I have a possibility to have virtually unlimited humanoid characters using for example Ready Player Me (I’m playing with creating an extension for RPM), but while their models are rigged, they are not animated. So other than for monuments, I can’t use use static humanoid models in my games
Alternatively, please expose or point me where I can access these from JS:
threejs object animations (source.animations in the code below)
SkeletonUtils from Three.js
THREE.AnimationMixer (also from Three.js)
The code below was vibe-coded by ChatGPT but it doesn’t work, the above listed items do not exist in GDevelop JS.
const source = srcObject.get3DRendererObject();
const target = targetObject.get3DRendererObject();
// take animations from source
const clips = source.animations;
// retarget skeleton
SkeletonUtils.retarget(target, source);
// copy animations to target and play the first one
const mixer = new THREE.AnimationMixer(target);
const action = mixer.clipAction(clips[0]);
action.play();
edit: I know for retargeting to work the rigs have to be the same and bone names as well, but there is a way to pass bone map to the retarget function of SkeletonUtils, I just didn’t want to complicate the code.
That’s correct. I don’t know much about Skeletonutils, but I can tell you that regarding 3D, it’s true that all bones need to be renamed (retargeted) to match the armature you want to use. However, you also need to pay close attention to the root bone and the model’s default axis rotation.
In any case, for what you’re trying to do, I don’t think you should run into these kinds of issues since that looks like Mixamo rig. So I believe renaming the bones should be enough
Thanks. I was hoping it would be possible to do this retargeting “on-the-fly” as I was already able to load RPM model from a URL and replace the previous model (from game resources) with the RPM model, but it’s static. If this retargeting can be done, in theory users could just copy their RPM model ID and start playing the game with their character model right away.
If manual retargeting has to be done before adding models to the game, it’s still cool, but you’d be able to use only predefined models (as is the case now).
Hello! Total noob here. I’m playing around with having 3D characters on Gdevelop and trying to figure out what are the possibilities. I know that the characters are .glb files with the 3D model and the animations included. However, I noticed in the 3D object properties there is an “+ Add an animation” button, but it doesn’t seem to have any option to add actual files or something. It seems useless right now. Since you are trying to figure out how to use animations from one glb 3D character on another, is it safe to say the button is indeed useless? :S
That (“Add an animation”) is only to map internal GDevelop object animation to an animation in GLB file manually. You can use “Scan missing animations” to map all animations from GLB file automatically.