I'm new to Babylon js and I'm looking through the documents now and I have a question about Animation

I’m currently looking documentation about village animation. Looking at the sample template provided by Babylon js, the car moves well and the npc walks well, but car wheel animation doesn’t work. I don’t know why the wheel animation is broken. The same goes for other templates related to car wheel animation. Does anyone know what the problem is.
And here is the url link to the templates that I looked.

1 Like

That’s a confusing guide, it’s a mix of different model types and manually created meshes for some reason… The animations are baked into the *.babylon file for how you are calling them, but you are using the *.glb file… I figured you could just make up a new animation for the wheels the same way as the whole car, but it doesn’t work with rotation for some reason?

1 Like

Hi and Welcome to the Forum,
And then, thanks for pointing out this issue. The reason why is not working is I believe perfectly clear to me. I must admit I didn’t open the model but from ‘the Inspector’ you can already see that there is no animationGroup imported from the model and the move of the car on z is also done through an animation created straight in BJS. So my guess is: There simply is no animation for the wheels in this version.
Fact is you are looking at a VERY old PG. A legacy PG, I should say :grin: …Probably would deserve a bit of an update :thinking: :sweat_smile:

I’m not all too sure who provided this in the first place. May be will want to cc @labris? Could be him…Else, I’let the team know that there’s no wheel animation in this PG at the moment @sebavan.

What are the other PGs that pretend to have a wheel animation and don’t? As said, lots of changes have been made in the framework over time. May be some even use older physics and didn’t receive the correct update. We’ll certainly want to fix this so if you could share these links of non-working examples from the doc… that would be HIGHLY appreciated :hugs:

Meanwhile, I quickly did a (not recommendable) fix in this PG. Simply to show you that, YES - indeed - the wheels can turn :joy: I’m a bit ashamed though because this is actually NOT the way it should be done. There are different ways depending on the requirement. For a start, I’d say that if all wheels simply turn together (without physics) you could already group the front and rear axis wheels. So you would have only two meshes to animate and blend in the animationGroup.
In fact, I believe there are lots of examples of cars in the forum (and some in the doc). May be just make search in this forum for #car #wheel.

Despite for the above little problem, I hope you are enjoying your time with BJS. Do not hesitate to reach out if anything and meanwhile, have a great day :sunglasses:

2 Likes

It doesn’t work in your PG because you are trying to use ‘rotation’ on a mesh that’s got a quartenion. You need to null it first or set NEW (vector3) if you want to use ‘rotation’. Else, it would be ‘rotate’ (from a quartenion) :grin:

1 Like

Here is the Doc section with all the PGs - Babylon.js docs

1 Like

Yes, I know this section. Quickly opened 3 of em and they actually all work.
So @dkArron , I wonder what are these other PGs that don’t work (if you can share the link(s)).
Because honestly, I don’t really feel like going through all of’em :face_with_hand_over_mouth:… lazy me :zipper_mouth_face: :joy: :rofl:

Hum? I just have to ask: Did you find this in Chapter 3? This chapter.
Because there’s nothing in the doc saying that the wheels would be animated in this example. It is simply about moving the car. The wheel animation is explained in another serie (shared above by @labris) and everything seems to work there (unless I missed something :face_with_hand_over_mouth:)

I KNEW it was a quaternion issue! Every time I run into or think about quaternions my mind aggressively detours to ANYTHING else :laughing:

1 Like

So, I’m not alone with this :joy: There are actually other people that would want to ban quartenions.
May be we should form a group of maths-relunctant people ? :joy: Try rally others under our banner :crossed_flags: NO QUARTENIONS, NO QUARTENIONS…Shout it with me! :speaker: :speaker: :speaker: :joy: :rofl:

1 Like

I am in, I know we need them but I hate them !!! :slight_smile:

2 Likes

sure , I dont think any 3d program handles rotations without them … internally. (Euler gimble lock )
For end users though there is almost no point in exposing them as 99.99% of us have no cooking clue how they work or how to set their quadrupal dimension values. ( I made that percentage up … its probably very accurate )

I’ve read over something like this in the docs , its definitely sounds like a design flaw in the code that probably should be fixed. Setting rotations via whatever should not be blocked because it was previously set with a quaternion… bury that thing deep where it belongs and let us carry on with 3 dimentional angles please.

2 Likes

Agreed. I believe this could be achieved (although don’t count on me to make the code for it :face_with_hand_over_mouth: :grin:) Should I place a feature request for this. It looks like we would already have the support from Sebavan and some other advanced users/members. I think it would increase the user experience, wouldn’t it?

I unfortunately do not think it is possible to hide them everywhere as there are no 1 2 1 conversion

Yes, in that chapter. And the document has the animated car script you mentioned, but the related PG has the wheel animation code, so I’m asking why it doesn’t work. But for many people’s help it got solved. Quaternion problems!!

Please post the PG example link from the doc (without modification) - as I’m currently unable to identify just which one it is (sorry :pray:). … If it really contains wheels animation (and is ment to have it), we’ll certainly want to fix it :face_with_monocle:

I don’t think that was the request/suggestion from @shaderbytes . The way I understand it is simply to remove the necessity of either nulling the quartenion or setting a NEW Vector 3 for ‘rotation’. In other words, the way I understand it is : Setting a value for ‘rotation’ on either axis (x,y or z) would actually (in the background) null the rotationQuartenion and set the new value for n-axis using ‘rotation’.

2 Likes