Entity - Model - nodeTransformations attribute (translation) issue

I studied the Cesium - Sandcastle - 3D Models Node Explorer Example, recommended by Hannah Pinkos February 2, 2016.

I created a model using SketchUp 2017. I exported the model (options: Triangulate All Faces, Preserve Component Hierarchies, Export Texture Maps) producing the file Chevron.dae.

Next, I used COLLADA|OBJ to GLTF converter to convert Chevron.dae to Chevron.gltf.

Next I create an entity with a model attribute:

var entity = viewer.entities.add({

name : url,

position : position,

model : {

    uri : "../model/Chevron.gltf",

    nodeTransformations : {

        node_1 : {

            translation : Cesium.Cartesian3(10.0, 0.0, 0.0)

        }

    }

}

});

In my entity creation, I call node_1 (from the list of nodes found in Chevron.gltf) and I want to translate it. As you can see in my example. I am moving its x position. It does not affect my model’s position.

When I switch the uri with one of the samples provided (Cesium_Man) and use any of the nodes (i.e. Armature). I see the affect that my translation has on that model.

var entity = viewer.entities.add({

name : url,

position : position,

model : {

    uri : "../model/CesiumMan/Cesium_Man.gltf",

    nodeTransformations : {

        Armature : {

            translation : Cesium.Cartesian3(10.0, 0.0, 0.0)

        }

    }

}

});

I suspect that I am not exporting the SketchUp correctly, or I am not calling the node in my gltf correctly, or my dae/gltf file is missing attributes.

Can you help me solve this problem?

P.S. When I get this solved, I would love to contribute an example of using nodeTransformations. I did a lot of Google Searching and there was no direct examples of its usage.

Chevron.dae (5.62 KB)

Chevron.gltf (6.54 KB)

Chevron.skp (79.8 KB)

nodeTransformations references the glTF node’s “name” property, which doesn’t exist in that model. Once it’s added the code works. Also you may want to target “rootNode” instead since “node_1” is a camera. Also side note, I got thrown off at first because the code snipped should be new Cesium.Cartesian3(10.0, 0.0, 0.0)

I think I may open a pull request so it can target the node’s id if the name doesn’t exist to avoid situations like this.

Sean,

Sorry about the confusion with the “new” before Cesium.Cartesian3.

I successfully tried your fix. Thank you so much.

Could I have used the ‘id’ instead (not sure what id, because I don’t see an attribute named id)?

Now I wonder why SketchUp doesn’t add the attribute “name” to the node like that?

Ah, what I mean by id is the name of the json object, not an id property. Glad it’s fixed.

I opened a PR here to make it work with the id or the name: https://github.com/AnalyticalGraphicsInc/cesium/pull/4870

Sean (or others),
While exporting models from Sketchup to .dae, the name that I provide to a Sketchup Group (a cube that I have named Group_A, for example) shows up in the .dae file as:

<node id="ID3" name="group_A">

However, upon converting to .gltf the name property disappears and must be added by hand.

Is there a method via Sketchup for maintaining the "name" property through the conversion to gltf?

Thanks, erik

This sounds like a bug with the COLLADA2GLTF converter, you may want to open an issue there (https://github.com/KhronosGroup/COLLADA2GLTF). I do think this is fixed on the 2.0 branch though.