pmndrs / drei

🥉 useful helpers for react-three-fiber
https://drei.pmnd.rs/
MIT License
7.83k stars 642 forks source link

DragControls Not Functioning Correctly #1995

Closed AshhadDevLab closed 2 weeks ago

AshhadDevLab commented 2 weeks ago

Problem description:

I am facing two issues with the DragControls component from @react-three/drei.

  1. Console Output Discrepancy: When I attach a ref to the DragControls or console.log the DragControls, the output is not as expected. Here is the output I receive:
Screenshot 2024-06-15 at 1 54 49 PM

In contrast, performing the same action with DragControls in vanilla three.js yields the expected methods and properties:

Screenshot 2024-06-15 at 2 09 17 PM
  1. Non-modifiable Recursive Property and Incorrect Drag Behavior: The recursive property of DragControls in the @react-three/fiber implementation cannot be modified. Additionally, when attempting to drag an object that is behind another object, the control behaves incorrectly by dragging all objects behind it, rather than the front-most object. This behavior mimics a raycaster .intersectObjects instead of the expected drag behavior. Also I dont understand the snapping of the objects kinda back to their original position.

https://github.com/pmndrs/drei/assets/58696726/10f5356c-79d3-43f0-87d2-c8e3a19ed42b

I am unsure if these are bugs or if I am missing some implementation details, but any help regarding these issues would be appreciated.

Relevant code:

CodeSandbox

Suggested solution:

I think there should be an individual prop for recursive and other properties inside of the React component. Additionally, when the ref is consoled, it should output the properties, the current state, and include the prototype and constructors of the DragControls.