drei icon indicating copy to clipboard operation
drei copied to clipboard

GizmoHelper + CameraControls, undefined defaultControls.target in GizmoHelper.js

Open saumac opened this issue 1 year ago • 5 comments

  • three version: ^0.161.0
  • @react-three/fiber version: ^9.73.3
  • @react-three/drei version: ^8.15.16
  • node version: v18.18.0
  • npm (or yarn) version: 4.1.0

Problem description:

Not sure if im doing something wrong but I cant get the two components to work together (I have set the makeDefault prop in CameraControls). The GizmoHelper is complaining about the defaultControls.target being undefined when I click on either side of the GizmoViewCube. Any ideas about what could be the issue?

saumac avatar Feb 16 '24 08:02 saumac

CameraControls has _target instead of target. We can do a check like const target = '_target' in controls ? controls._target : controls.target and gracefully fail if either are undefined.

CodyJasonBennett avatar Feb 16 '24 22:02 CodyJasonBennett

I tried that but it made the camera "flicker" in a strange way. Not sure if the tween logic needs some update too. I'll give it a one more go.

If it works you or if you find another solution, let me know 🙏🏼

saumac avatar Feb 17 '24 07:02 saumac

The issue is that controls' spherical orientation is not updated, so when the gizmo is done animating, the controls reverts back to its stored state.

CodyJasonBennett avatar Feb 19 '24 09:02 CodyJasonBennett

@CodyJasonBennett Any ideas where an update should be made to the controls orientation? I have been testing out some changes but nothing seems to really fix it...

saumac avatar Feb 19 '24 20:02 saumac

Any news or potential fixes for this issue ? It's quite a pain that the CameraControls can't work with the GizmoHelper...

Mathys-Gasnier avatar Apr 23 '24 12:04 Mathys-Gasnier