Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3dtiles setting scaling is invalid #2429

Closed
liangyuan1 opened this issue Oct 8, 2024 · 1 comment
Closed

3dtiles setting scaling is invalid #2429

liangyuan1 opened this issue Oct 8, 2024 · 1 comment
Assignees
Labels

Comments

@liangyuan1
Copy link

How to scale the model and modify its position on the map while automatically switching the perspective to the position of the model after changing the scaling ratio, which causes the model to be lost after converting manual modeling data into 3dtiles for loading

Your Environment

  • Version used:2.44.0
  • Browser Name and version:
  • Operating System and version (desktop or mobile):
  • Link to your project:

Scale not set

###code
view.addLayer(layer).then((layer) => {
zoomToLayer(view, layer)
})

result

image

Scale set

###code
view.addLayer(layer).then((layer) => {
layer.object3d.scale.set(3, 3, 3)
layer.object3d.updateMatrixWorld()
zoomToLayer(view, layer)
})

result

image

@jailln jailln self-assigned this Oct 14, 2024
@jailln
Copy link
Contributor

jailln commented Oct 14, 2024

Hi, thanks for reporting this issue.

Scaling the group does not work indeed. However, scaling the tiles when they are loaded does work:

  layer.addEventListener('load-model', (m) => {
      m.scene.scale.set(2, 2, 2);
      m.scene.updateMatrixWorld();
  });

My guess is that it's because the group is positioned in (0,0,0) and the tiles are positioned on the globe, so scaling is applied relatively to the position of the group (instead of the tiles position) which messes up the tileset position.

I'll close this since I provide a workaround and 3D tiles are generally already scaled and positioned correctly so I don't think we should provide a specific API to help for scaling (or rotating) them. However, feel free to reopen it if needed. cc @Desplandis too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants