Loading in meshes/scene, rotation issue?

I am loading in a .babylon file that was exported from Maya.

It has 3 meshes in it, 2 stationary base pieces and a gun that is supposed to pivot on top of the base.

I have been playing around in the sandbox and the editor to make sure the model works and I am having issues with the rotation of the gun mesh, in the sandbox I can’t get the gun mesh to rotate at all, if i change the rotation values, it resets back to 0.

In the editor, I also have the same issue, but if i create an instance of the gun mesh, and disable the original mesh, i can rotate the instance of it just fine.

My question is, is this how it is supposed to behave? Do I need to create an instance of any mesh that I want to dynamically move in my scene?

It probably has a rotationQuaternion, so the rotation values are ignored. You can read more about that here:

specifically: When a rotationQuaternion is set the value of rotation is set to (0, 0, 0)

1 Like

@brianzinn thanks for the info. I still seem to be having issues though.

I literally cannot rotate these meshes, using the rotate or addrotation functions doesnt work, setting the rotationQuaternion value directly doesnt work. I and pulling my hair out over this.

I am loading my meshes in like this

let scene = this._scene;
SceneLoader.ImportMesh([“Launcher_Base”, “Launcher_Cannister”, “Launcher_Gun”], “/assets/”, “Launcher_Gun.babylon”, scene, function (newMeshes, particleSystems, skeletons)

Ideally I would like to store the gun mesh so that I can change the rotation of it when I need to, the other 2 meshes are static and will not move, the meshes don’t have skeletons.

Here is the .babylon file and texture I am using, im not sure if theres an issue with the export from maya or not, or if I am doing something wrong
launcher.zip (532.0 KB)

Ok after digging further into the meshes when loading, it appears to have 4 animations, one each for scale, position, rotationQuaternion and visibility, these animations appear to keep the values of these properties at the default value and nothing else, and they seem to play automatically, I tried stopping all animations, and then the rotation on my mesh started working fine.

Is this something that would be exported from Maya? I just had a chat with the artist who made the model and there were no animations defined on the model, so we are unsure as to how these animations got there.

Can anyone think of anything? I can at least work around these “animations”, but i would like to know why they are there

Edit: the animations defined in the file are the following JSON

“animations”:[{“name”:“scaling animation”,“property”:“scaling”,“dataType”:1,“enableBlending”:false,“blendingSpeed”:0.01,“loopBehavior”:1,“framePerSecond”:24,“keys”:[{“frame”:1,“values”:[1.0,1.0,1.0]},{“frame”:200,“values”:[1.0,1.0,1.0]}]},{“name”:“rotationQuaternion animation”,“property”:“rotationQuaternion”,“dataType”:2,“enableBlending”:false,“blendingSpeed”:0.01,“loopBehavior”:1,“framePerSecond”:24,“keys”:[{“frame”:1,“values”:[0.0,0.0,0.0,1.0]},{“frame”:200,“values”:[0.0,0.0,0.0,1.0]}]},{“name”:“position animation”,“property”:“position”,“dataType”:1,“enableBlending”:false,“blendingSpeed”:0.01,“loopBehavior”:1,“framePerSecond”:24,“keys”:[{“frame”:1,“values”:[0.0,0.0,0.0]},{“frame”:200,“values”:[0.0,0.0,0.0]}]},{“name”:“visibility animation”,“property”:“visibility”,“dataType”:0,“enableBlending”:false,“blendingSpeed”:0.01,“loopBehavior”:1,“framePerSecond”:24,“keys”:[{“frame”:1,“values”:[1.0]},{“frame”:200,“values”:[1.0]}]}],“autoAnimate”:true,“autoAnimateFrom”:1,“autoAnimateTo”:200,“autoAnimateLoop”:true}

(sorry for the terrible json formatting)

Maybe @kcoley might have insight into this if he’s around. Do you know if you are using the latest version of the exporter? Have you tried the glft exporter and does it have the same issue?

@trevordev It looks like the gltf version has an animation track called “All Animations” in it that is doing the same thing as the animations in the babylon file.

I can also guarantee that there are no animation groups in maya before export, and no animations have been created in maya either.

Hi @Shurp. Can you provide a sample Maya scene that repros the issue?

1 Like

@kcoley try this one - launcher_3.zip (56.5 KB)

@Shurp the issue was related to a change I made recently to allow exporting of animations with two key frame values of the same value. In your case, your model was not animated, but an animation clip was generated since the exporter did not check to see if the start and end values of the sequence were at the identity positions (position at origin, scale at 1, no rotation).

I just pushed an update to check if the scale, rotation and translation values are not the identity values. If they are not, then animations would be exported:

test.zip (45.6 KB)

You can try to see if this works for you.

1 Like

@kcoley Thanks! that model seems to work ok.

While I was playing around with the files, I noticed that if I set the autoAnimate property for the animations to false, then i can use the models properly. But having them without those animations in the first plase is better anyway.

1 Like