I have a renderPlanes function to dinamically generate several “planes” (box meshes). I want to animate those planes so I added a rotatePlanesAnimation : BABYLON.Animation I set it up and then I push it to each planeMesh.
The code seems to run, but nobody is moving! Any hints?
Yes, please do. We are always eager to see what can be achieved with other engines. And then, rest assured that if you cannot do BETTER and EASIER with BJS, we’ll make sure to fix it ASAP
Totally agree. The doc, the PGs, the snippets servers AND the community altogether are the pillars and unique advantages that made me make the move to BJS. Not to mention that (in my opinion) this framework and these people are the most trustable from the new Internet.
Again, welcome to our family and hope to hear from you soon. Meanwhile, have a great day
Hi @mawa ok I see.
To perform a whole revolution, the frames must go from 0 to 360 degrees and that is 2 * π. Got it.
Regarding the loops, I meant having only one loop instead of two. So I added this line scene.beginAnimation(planeMesh, 0, 360, true); inside the renderPlanes function. Just because it’s already looping through the recently created plane meshes.
Here’s my resulting PG
Is it a good idea to use the FPS parameter on the BABYLON.Animation to handle animation speed?
Would it be better to use a variable, from 0 to 1 ?
Yes, I understand now. I believe it doesn’t make a difference. The animation cannot run multiple times (at least not in a for loop). Only the last will be accounted. But I agree it’s cleaner this way.
It always is. Although from what you have now, there is little chance that even lower end systems will run at a lower frame rate. But it’s still good practice to do so, I believe. Not as if it was a lot of additional effort
Hi, I managed to trigger one animation after the other.
Please excuse me for the “non elegant” code. I’m aware that on line 66, this is the book definition of “callback hell” (just wanted to make it work quickly)
Anyways, why is the first block moving permanently? I want to make it behave like the rest of them. Rotate once and then stop. Then the next one.
Sorry, sent the wrong PG.
Now callback hell is on line 58
Question: when I create a mesh, using BABYLON.MeshBuilder.CreateBox, then I can add an array of animations to that mesh. How does that work? Does it mean the animations will run at the same?
Is BABYLON.Animation supposed to have ONLY one targetProperty?