Hi everyone,
A video is visible here.
I have created a scene with 3 animated robots:
Red one
Parent object: Obj_R_01
100 frames / 4 seconds
Green one
Parent object: Obj_G_01
200 frames / 8 seconds
Blue one
Parent object: Obj_B_01
300 frames / 12 seconds
For now, the R and G robots are waiting for B one to end its cycle.
I want them to loop with their own time length, shorter than the major on (12 sec).
Is there a way to control the length of the animation, only for a part of the object hierarchy?
=> For example, ask to Obj_R_01 and its children to loop every 100 frames, while Obj_B_01 loops every 300 frames?
My code is based on the webgl_loader_gltf and the webgl_animation_keyframes examples.
Thanks a lot
Three robots code.html (3.3 KB)
In the code it looks like you’re only loading a single model, and a single animation.
I can’t see the original in Blender, but can you split it’s animations into three NLA Tracks to export three animations, or export three separate models? A single AnimationClip only loops on its total time; you’d need three AnimationClips to do what you describe.
Thank you for your answer, donmccurdy!
As suggested, I have split my scene in four parts, exported separately:
scene0.gltf (not animated)
sceneR.gltf
sceneG.gltf
sceneB.gltf
I have adapted my code Three robots code.html (5 KB) but it seems that the clock considers the longest animation (sceneB).
Maybe is there a mistake in my animate function?
Thanks!
Your code looks right to me. Are you able to share the models?
Very nice.
Here are the models (4 x gltf) + (4 x bin).
Question 3 Robots.zip (70.1 KB)