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

GizmoHelper with Z up camera wrong rotations #2321

Open
mqrty opened this issue Jan 24, 2025 · 2 comments
Open

GizmoHelper with Z up camera wrong rotations #2321

mqrty opened this issue Jan 24, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@mqrty
Copy link

mqrty commented Jan 24, 2025

  • three version: 0.167.1
  • @react-three/fiber version: 8.17.12
  • @react-three/drei version: 9.121.3

Problem description:

If you use Z as the camera UP axis and click the gizmo axis heads, the rotation is wrong for most of them.

Relevant code:

Codesandbox

import React, { useRef } from "react";
import ReactDOM from "react-dom";
import { Canvas } from "@react-three/fiber";
import { GizmoHelper, GizmoViewport, OrbitControls } from "@react-three/drei";

ReactDOM.render(
  <Canvas
    style={{ position: "absolute", inset: 0 }}
    camera={{ up: [0, 0, 1], position: [2, 2, 2] }}
  >
    <axesHelper />
    <OrbitControls makeDefault enableDamping={false} />
    <GizmoHelper>
      <GizmoViewport />
    </GizmoHelper>
  </Canvas>,
  document.getElementById("root")
);

Suggested solution:

Video

gizmohelper.mp4
@mqrty mqrty added the bug Something isn't working label Jan 24, 2025
@gbertoncelli
Copy link

gbertoncelli commented Jan 24, 2025

Same issue here! I have also this error after clicking for a specific rotation:

Cannot use 'in' operator to search for 'getTarget' in null
Image

I'm using a custom OrthographicCamera, a OrbitControls and setting up both on THREE.Object3D.DefaultUp.set(0, 0, 1) and camera.up...

@gbertoncelli
Copy link

Same issue here! I have also this error after clicking for a specific rotation:

Cannot use 'in' operator to search for 'getTarget' in null
Image I'm using a custom OrthographicCamera, a OrbitControls and setting up both on `THREE.Object3D.DefaultUp.set(0, 0, 1)` and `camera.up`...

Solved the error by setting makeDefault to OrbitControls, sorry for the OT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants