Hi I’m Julio from Costa Rica and I’m new to the forum.
I’m getting to know Babylon.js and so far what I’ve read, seems pretty cool. Documentation is really good.
I’ve done a few three.js demos and I want to re-create them using Babylon.js. I’ll post some examples as soon as I get something done. Please feel free to add suggestions or comments.
Hi @jade and welcome to the community. Looking forward to seeing your demos and the Babylon.js versions. Plenty of help available here on the forum for you.
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
Would it make sense to add this line " scene.beginAnimation(planes[i], 0, 30, true);" inside the renderPlanes function, so the code doesn’t loop twice through all the plane elements?
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?