andyZou Posted September 18, 2016 Share Posted September 18, 2016 Recently I need to produce about 5 minutes of animation(more than twenty dirfferent people perform this animation ),How to use babylonjs to achieve this goal. Currently think of two ways: use 3DMax to make whole animation, then import it.But the problem is data file is so big and how to achieve the goal of different people perform? animation split into a small module,then import them in turn,But question is How to control the order of each small module? Finally, What is a good way to achieve the goal of different people perform the same animation efficient? Sincere thanks. Quote Link to comment Share on other sites More sharing options...
andyZou Posted September 19, 2016 Author Share Posted September 19, 2016 for the first way, I can specify the frame to animate.But if I want to play another animation, I should reload data file.Is it waste resources? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 19, 2016 Share Posted September 19, 2016 Hello! I'm not sure to get what you want to achieve. What do you mean by "different people". Are you talking about bones/skeletons? If yes then you can simply create your animation on a specific mesh in 3dsmax and then clone this mesh using javascript. Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 19, 2016 Share Posted September 19, 2016 @andyZou This is what I imagine you want but at times my imagination is too complex. Animator A, is creating animation A which uses one or more animated meshes. Animation runs from time T[A][0] to T[A][1]. Each animation is saved to a file. These files are imported into Babylonjs. Each file needs to be played at the correct time. Is this possible? Is this close to what you need? EDIT reading your later message seems I have got it wrong (again ) Quote Link to comment Share on other sites More sharing options...
andyZou Posted September 20, 2016 Author Share Posted September 20, 2016 14 hours ago, Deltakosh said: Hello! I'm not sure to get what you want to achieve. What do you mean by "different people". Are you talking about bones/skeletons? If yes then you can simply create your animation on a specific mesh in 3dsmax and then clone this mesh using javascript. @Deltakosh Well, I mean twenty people play the same long time animation.How to fix the problem of data file is so big? Now, I doped out a solution to the problem: import a mesh with skeleton animation. import another nineteen mesh without skeleton animation and copy the skeleton animation to them play whole roles animation But my code doesn't work. Here's my code: var dude; BABYLON.SceneLoader.ImportMesh("", "./data/char/", "char1.babylon", scene, function (newMeshes, particleSystems, skeletons) { dude = newMeshes[0]; }, function(progress) { if(progress.total == progress.loaded) { for(var i=1; i<=12; i++) { BABYLON.SceneLoader.ImportMesh("", "./data/woman/", "woman_static_"+i+".babylon", scene, function (newMeshes, particleSystems, skeletons) { var position = new BABYLON.Vector3(Math.random()*100 / 10 - 5, 0, -2); for(var i=0; i<newMeshes.length; i++) { newMeshes[i].position = position; } for (var i = 0; i < dude.skeletons.length; i+=1) { skeletons[i] = dude.skeletons[i].clone("skeleton clone #"+i); scene.beginAnimation(skeletons[i], 0, 120, 1.0, true); } }); } } }); Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 20, 2016 Share Posted September 20, 2016 var dude; BABYLON.SceneLoader.ImportMesh("", "./data/char/", "char1.babylon", scene, function (newMeshes, particleSystems, skeletons) { dude = newMeshes[0]; for(var i=1; i<=12; i++) { BABYLON.SceneLoader.ImportMesh("", "./data/woman/", "woman_static_"+i+".babylon", scene, function (newMeshes, particleSystems, skeletons) { var position = new BABYLON.Vector3(Math.random()*100 / 10 - 5, 0, -2); for(var i=0; i<newMeshes.length; i++) { newMeshes[i].position = position; } for (var i = 0; i < dude.skeletons.length; i+=1) { skeletons[i] = dude.skeletons[i].clone("skeleton clone #"+i); scene.beginAnimation(skeletons[i], 0, 120, 1.0, true); } }); } }); This should work better Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.