Md. Shohag Mia
Md. Shohag Mia

Reputation: 374

How can I get the x,y,z axes in forge viewer which is similar to HUD in Navisworks?

I want to show X,Y,Z axes in forge viewer at the bottom-left corner like Navisworks. I can create the axes lines (described here) in a certain position of the viewer. But, as expected, whenever I navigate to somewhere the axes also moves. I want it to be placed at the bottom-left corner every time and syncing with the viewer X,Y,Z axes. The Navisworks axes in HUD is like below -

enter image description here

Please share some good idea!

Upvotes: 0

Views: 666

Answers (1)

Petr Broz
Petr Broz

Reputation: 9942

Forge Viewer doesn't offer this feature out-of-the-box but it should be pretty straightforward to implement something similar yourself.

I'd recommend using the approach used by the viewer's "view cube" (in the top-right corner). That cube is actually rendered in its own <canvas> element, and overlaid on top of the viewer canvas. You could create your own <canvas> element in the bottom-right corner, use standard three.js (specifically version 71 that's included in Forge Viewer) to render your axes there, and update their orientation based on the viewer's Autodesk.Viewing.CAMERA_CHANGE_EVENT.

Upvotes: 2

Related Questions