Hessu Hopo
Hessu Hopo

Reputation: 11

Forge Viewer multi-model context and pivot point

We have a multi-model loaded into the viewer. The coordinate systems of the models are similar, with no major deviations. All tools appear to be working normally.

The pivot point appears to update annoyingly as the viewer state changes. For example, when the user zooms with the mouse wheel, the pivot point moves somewhere outside the screen. The WheelSetsPivot setting does not fix the problem. Viewer version is 7. We have tried many viewer versions without any luck.

When loading only one model into the viewer pivot point works as expected.

How can I fix this to work like one-model case? Any settings for multi-model context or for pivot point?

Upvotes: 0

Views: 175

Answers (2)

Hessu Hopo
Hessu Hopo

Reputation: 11

The problem was the viewer's old style aggregate view init (viewer version 6?) for multi-model context. When I updated multi-model loading to v7 style (loadDocumentNode), everything seems to be working as expected.

Upvotes: 1

Eason Kang
Eason Kang

Reputation: 7070

If I understand the situation you addressed, you mean when user is zooming and another model is loaded, the camera will move to somewhere, right?

If so, haven't you included preserveView: true in the loadModelOptions when calling Viewer3D#loadDocumentNode? This option can prevent Forge Viewer from auto-resetting camera state automatically on adding a new model to the scene.

const loadModelOptions = {
  keepCurrentModels: true,
  preserveView: true,
  // ...
};

viewer.loadDocumentNode( doc, viewalbe, loadModelOptions );

Upvotes: 0

Related Questions