I have a BIM building design and a custom model in forge scene. I moved the custom model 1 unit on the X axis with the following method mesh.matrix.setPosition(new THREE.Vector3(1, 0, 0))
. I want that the displacement of 1 unit is equal to 1 meter.
My question :
Try loading your Forge model with the applyScaling
property set to meters
, for example, like so:
async function loadModel(viewer, urn) {
return new Promise(function (resolve, reject) {
function onDocumentLoadSuccess(doc) {
const viewable = doc.getRoot().getDefaultGeometry();
const options = {
applyScaling: 'meters'
};
viewer.loadDocumentNode(doc, viewable, options)
.then(resolve)
.catch(reject);
}
function onDocumentLoadFailure(code) {
reject(`Could not load document (${code}).`);
}
Autodesk.Viewing.Document.load('urn:' + urn, onDocumentLoadSuccess, onDocumentLoadFailure);
});
}
That way, if the loaded model is defined in different units, the viewer will scale it so that 1 unit in its geometry will represent 1 meter.