The FreeCamera node animation is not being exported in GLTF
Here is a PG https://playground.babylonjs.com/#HZBCXR#98
Blender
In Blender, the green box is animated as normal, but the freecamera does not have any animation
The FreeCamera node animation is not being exported in GLTF
Here is a PG https://playground.babylonjs.com/#HZBCXR#98
Blender
In Blender, the green box is animated as normal, but the freecamera does not have any animation
I noticed the reason
Why are we limiting GLTF exports to transformnodes? Why not make it available for other nodes e.g. freecamera/lights? I don’t see a reason for this
I’m working around this by parenting the camera to a Tnode, and then exporting both the Tnode and camera.
But then I found this bug GLTF Export Bug: FreeCamera rotation has wrong offset
cc @Guillaume_Pelletier and @bghgary
Exported nodes are defined with
const nodes: Node[] = [...babylonScene.transformNodes, ...babylonScene.meshes, ...babylonScene.lights, ...babylonScene.cameras];
along the export process.
While camera is part of the GLTF specification and linked to a node it might be animated, I beleive this is a bug, where we should have something like
if (babylonNode instanceof TransformNode || babylonNode instanceof Camera) {
It’s might be also the same for the Light with the support of the KHR_lights_punctual extension.
@bghgary ??
Camera export was added recently. We seemed to have missed the animation part. Seems like an oversight. Also seems likely lights will be in the same boat.
Yea, I think this bug GLTF Export Bug: FreeCamera rotation has wrong offset - #9 by Guillaume_Pelletier would have to be patched prior to this animation part, since that affects the rotations (and hence animations) regardless
This is fixed, few more tests and i will publish a PR this afternoon (my time CET).
hey @Guillaume_Pelletier !
thanks a lot for the fix! any idea where we can use it ?
i.e. which beta version… because I was on the playground and the bug still occurs (with the following error codes when importing the file to blender)
This was included into this PR
If you are using the playground, it should be on the latest already, which probably means this is a different problem. Do you have a repro?
Update:
playing with the camera type seemed to fix one aspect of the export. Now, the resulting gltf file works fine in the sandbox (problem seems to be the coordinate system getting inverted in the freeCamera, so switched to a UniversalCamera).
so, to fix the first part, I had to:
The problem remains in blender though, animation cannot be found on blender
final update, @MeshSlayer looked into the animation data that was causing the issue, and found the “final” bug.
when creating the rotation animation, the target property was “rotation.y” (a float), @MeshSlayer had the idea to change that to "rotation (a Vector3) and it worked like a charm.
the animation works perfectly on blender now.
here’s the final playground: