Learn Cognite 3d model, focus object, fit camera, search assets highlight object etc..
Solved
Learn Cognite 3D Model
Best answer by Lars Moastuen
pramod.s wrote:
To focus at a clicked object in Reveal, you can do
- Get “Point intersection with the object” using Cognite3DViewer.getIntersectionFromPixel(offsetX, offsetY).
-
Create a bounding box around intersection point like
const boundingBox = new THREE.Box3(); boundingBox.setFromCenterAndSize(intersection.point, new THREE.Vector3(1, 1, 1));
- Use this bounding box in Cognite3DViewer.fitCameraToBoundingBox()
viewer.fitCameraToBoundingBox(boundingBox, 250);
Note that rather than using bounding box directly from the CDF API, it’s recommended to use https://cognitedata.github.io/reveal-docs/docs/api/classes/cognite_reveal.CogniteCadModel#getboundingboxbynodeid to get bounding box for a given node as this accounts for any transformation active on the model.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.