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

modelviewer ar-placement= wall is flipping the glb model #4771

Open
7 of 13 tasks
anil-arnxt opened this issue May 6, 2024 · 10 comments
Open
7 of 13 tasks

modelviewer ar-placement= wall is flipping the glb model #4771

anil-arnxt opened this issue May 6, 2024 · 10 comments

Comments

@anil-arnxt
Copy link

anil-arnxt commented May 6, 2024

Description

I am using modelviewer to show glb model of an AC on the wall but its flipping it 360 degree when i place it on the wall.

Live Demo

Version

Screenshot_2024-05-06-12-29-24-231_com android chrome

Browser Affected

  • Chrome, version: xx.x.xxxx.xx
  • Edge
  • Firefox
  • IE
  • Safari

OS

  • Android
  • iOS
  • Linux
  • MacOS
  • Windows

AR

  • WebXR
  • SceneViewer
  • QuickLook
@vincentfretin
Copy link

This is discussed in #3989

@anil-arnxt
Copy link
Author

Thanks for your reply. But I am working on Android not ios.

@anil-arnxt
Copy link
Author

VID_20240506_150905_0_COMPRESSED.1.mp4

@vincentfretin
Copy link

From the video, it seems to be an issue with SceneViewer on Android. In this case please check only the correct checkboxes on the issue. Not sure if we can do anything about it.
You can set ar-modes="webxr quick-look" to force using webxr and not scene-viewer on Android. I didn't have an issue with webxr mode on Android.

@anil-arnxt
Copy link
Author

 <model-viewer
                    id="change-speed-demo"
                    camera-controls
                    touch-action="pan-y"
                    src={glbFile}
                    ar
                  ar-placement={placement}
              
                    alt="A 3D model of a helmet"
                    ref={modelViewerRef}
                    animation-name="Dance"
                    ar-modes="webxr scene-viewer quick-look"
                    shadow-intensity="1">
                    <button
                      slot="ar-button"
                      id="ar-button"
                      onClick={handlearclick}>
                      View in your space
                    </button>
                      {showOverlay && (
                    <div className="overlay">
                      <p>Move your device to place the object in AR</p>
                      <button onClick={handlePlaceObject}>Start AR</button>
                    </div>
                  )}
                  <div id="ar-prompt">
                    <img src="https://modelviewer.dev/shared-assets/icons/hand.png" />
                    <div id="wall_floor">
                      Move Camera on the <span>{placement}</span>
                    </div>
                  </div>

                  <div id="ar-failure">AR is not tracking!</div>
                    {hasAnimation && (
                      <div id="controls">
                        <button onClick={handleToggleAnimation}>
                          {isPlaying ? <FaPause /> : <FaPlay />}
                        </button>
                      </div>
                    )}
                  </model-viewer>  

this is my code for ios its not flipping but when opening on android its flipping the model.

@elalish
Copy link
Collaborator

elalish commented May 13, 2024

No, that's WebXR mode alright. Weird! Does that repro reliably even on other walls? The only thing I can imagine is that the returned hit matrix has an inverted normal. @bialpio Have you ever seen anything like this, or have a thought as to where in the code that could happen? The relevant piece of MV code is:

    if (this.placeOnWall === true) {
      // Orient the model to the wall's normal vector.
      this.goalYaw = Math.atan2(hitMatrix.elements[4], hitMatrix.elements[6]);
    }

which I don't see any problems with. hitMatrix is returned right from the WebXR API.

@elalish
Copy link
Collaborator

elalish commented May 13, 2024

@anil-arnxt Can you fill in the device and OS/browser version info so we can try to repro?

@anil-arnxt
Copy link
Author

@elalish I am using Android version 12 and chrome browser.

@elalish
Copy link
Collaborator

elalish commented May 15, 2024

@anil-arnxt Can we have more details on your device type and browser version? (the xx.x.xxxx.xxx are intended to be filled in by you as part of the issue template).

@anil-arnxt
Copy link
Author

@elalish please see my device that is mobile details
Screenshot_2024-05-16-10-50-01-027_com android settings
Screenshot_2024-05-16-10-49-54-807_com android settings
Screenshot_2024-05-16-10-50-23-641_com android chrome

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

No branches or pull requests

3 participants