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

Camera-orbit attribute ignored in certain cases #592

Closed
pushmatrix opened this issue May 31, 2019 · 5 comments
Closed

Camera-orbit attribute ignored in certain cases #592

pushmatrix opened this issue May 31, 2019 · 5 comments
Labels
flag: not model-viewer Problems that are related to our project but are ultimately some other project's issue flag: partner Issues or PRs opened by an integrating partner, or affecting one in an important way type: bug Something isn't working

Comments

@pushmatrix
Copy link
Contributor

pushmatrix commented May 31, 2019

Description

I'm trying to implement a reset button that sets the camera-orbit parameter back to a default (eg: "0deg 90deg 1m")

So after the user spins a model around, they can press the button to reset the view. The problem is when you spin the model around, the camera-orbit param does not get updated to reflect the model's new position. I understand that's because we don't want to update the DOM every frame.

But that means that the camera does not move because the camera-orbit parameter has never changed from "0deg 90deg 1m", even though the model did visually rotate.

My workaround right now is to remove the camera-orbit attribute before setting it.

Live Demo

Follow repro instructions here:
https://dapper-blender.glitch.me

Browser Affected

All browsers

OS

All OS

Versions

  • model-viewer: v0.3.1
  • three.js: r101
@cdata
Copy link
Contributor

cdata commented Jun 3, 2019

@pushmatrix we rely on UpdatingElement semantics for this (see the property configuration here). So, in theory the value should always report as changed, even when you are setting it to the same value that it was set to previously.

Have you been setting it via setAttribute? Did you also try setting its property form (e.g., modelViewer.cameraOrbit = '0deg 90deg 1m')? Do you get the same result from both?

@pushmatrix
Copy link
Contributor Author

Yeah both setAttribute or jQuery's attr and no dice.

Setting it from modelViewer.cameraOrbit = '0deg 90deg 1m' does work as intended

@cdata
Copy link
Contributor

cdata commented Jun 4, 2019

I discussed this with the TLs of LitElement, and they agreed that this is something that UpdatingElement is undermining. I filed lit/lit-element#699 to request a change.

In the mean time, you should be able to assign the property as a workaround.

@cdata cdata added flag: not model-viewer Problems that are related to our project but are ultimately some other project's issue type: bug Something isn't working flag: partner Issues or PRs opened by an integrating partner, or affecting one in an important way labels Jun 4, 2019
@elalish
Copy link
Collaborator

elalish commented Jul 30, 2020

I don't think we need to track this one.

@elalish elalish closed this as completed Jul 30, 2020
@emreboyraz0
Copy link

emreboyraz0 commented Mar 20, 2024

    `for (const attr in extraAttributes) {
        modelViewer.setAttribute(attr, extraAttributes[attr]);
    }
    modelViewer.jumpCameraToGoal(); // this line ` 

solved my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: not model-viewer Problems that are related to our project but are ultimately some other project's issue flag: partner Issues or PRs opened by an integrating partner, or affecting one in an important way type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants