Ability to dynamically position & rotate SceneModel anywhere within World coordinate system #1136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Interactive model translation and rotation
Useful for interactively/automatically aligning point clouds and architectural models
This PR adds the ability to dynamically move and rotate models anywhere within the extents of xeokit's double-precision coordinate system.
Previously, we could only move a model a short distance, before it showed rounding errors (render jitter).
The snippet below shows what's possible after this PR. In this snippet, we load a model, which happens to be more-or-less centered at
[0,0,0]
. Once loaded, we then rotate the model 90° about its X-axis and translate it to a very far distance,[1000000000.0, 0, 0]
, away from the origin of the viewer's World space coordinate system.Translation and rotation is cheap to do, and can be done at the full speed of the viewer's renderer. This means that we could interactively control translation and rotation from mouse/touch input, to enable users to manually align models, such as point clouds with architectural models.
The screen capture below shows another simple example, in which we're animating the translation and rotation of a simple programmatically-generated model. The model is translated from
[1000000000, 0, 0]
to [1000000100, 0, 0]`, while tumbling about its Y and Z axis. This model is made up of four "table" objects, each in its own RTC tile. The coordinates of each table are relative to the center (RTC) of its tile. This demo shows how translation and rotation continues to preserve the tiled coordinate system used by the four tables in the model.Screencast.from.15.09.2023.00.54.48.webm
The animation loop to update the
SceneModel
position
androtation
properties looks like this: