Rotate root node of imported glb file


#1

I have an issue in my current project which seems to not allow to setup the orientation of an imported gltf file.

Playground scene

I want to rename the default __root__ node created on import ('cause I have to load/unload many files, and naming the root object make them easy to spot), and then playing with its Y rotation.
But it seems to be overwritten somewhere, even after the onLoad of the ImportMesh.

Is my way to manipulate the imported file wrong?


#2

This is because in gltf we rely on quaternions:
https://www.babylonjs-playground.com/#J21C6T#1

Let me now summon @Deltakosh to figure an easy to spot way from the inspector :slight_smile:


#3

OK! thanks for the explanation.

Maybe this deserve a point on this doc page? Babylon.js Documentation


#4

I can probably hide the rotation property if there is a rotation quaternion one
And it is mentioned in the doc that rotation quaternion is higher priority than rotation:)


#5

I like the property as it works great, maybe renaming or adding something to know it is a quaternion that is used ?


#6

@Vinc3r: how do fell about my idea?


#7

I think just hiding the rotation property will not be explicit. As sebavan suggesting, we have to see that a quaternion is used.

Don’t know if possible to make something like that:

Or, probably a lot more simple:


#8

I did not mean to hide it but to replace it by the rotationQuaternion property


#9

That looks OK for me.


#10

ok then I’ll do that :slight_smile:


#11

Wait! this is already the case. If there is a quaternion it is already used Oo
But for some reasons it is not working…

Fixing it right now :slight_smile:


#12

Seems to work now, GG


#13

My pleasure!