How to view the 3D model in wire-frame mode?

I’ve checked this documentation about the model. It says, using “debugWireframe” properties we can see the model in wire-frame mode.

I’ve tried that api in Sandcastle, but it still shown the complete model.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

infoBox : false,

selectionIndicator : false

});

function createModel(url, height) {

viewer.entities.removeAll();

var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);

var heading = Cesium.Math.toRadians(135);

var pitch = 0;

var roll = 0;

var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);

var entity = viewer.entities.add({

    name : url,

    position : position,

    orientation : orientation,

    model : {

        uri : url,

        minimumPixelSize : 128,

        debugWireframe: true

    }

});

viewer.trackedEntity = entity;

}

createModel(’…/…/SampleData/models/CesiumAir/Cesium_Air.glb’, 5000.0);

``

Is there anything wrong with the code. Am I implemented in the wrong place?

Please advice.

Hello,

The debugWireframe option has not been piped through to the entity API, that is why this isn’t working.

If you want to view your model as a wireframe, you can do it like this:

//Create model matrix to position the model on the globe surface
var origin = Cesium.Cartesian3.fromDegrees(-123.0, 44.0);
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll);
//Add model to the scene
var model = scene.primitives.add(Cesium.Model.fromGltf({
url : url,
modelMatrix : modelMatrix,
debugWireframe: true
}));

``

Hope this helps!

-Hannah

Thank you for the response Hannah!

I suppose to toggle the model wire-frame dynamically. I got that, the debugWireframe property inside primitives. I’ve implemented as below.

var pick = scene.pick(movement.position);
pick.primitive.debugWireframe = true or false;

``