-
Notifications
You must be signed in to change notification settings - Fork 788
Closed
Labels
Milestone
Description
threeversion: 0.173.0@react-three/fiberversion: 8.17.14@react-three/dreiversion: 9.121.4nodeversion: N/A (sandbox)npm(oryarn) version: N/A (sandbox)
Problem description:
My naive expectation would be that using a DragControls within a RenderTexture, the dragged object would track the mouse's raycasted position across the surface the texture is rendered on (such as the threejs raycast texture example). Instead, it seems to map to the mouse's position across the Canvas.
dragcontrols.within.rendertexture.2.mp4
Relevant code:
https://codesandbox.io/p/sandbox/kws3cx
<Box>
<meshStandardMaterial>
<RenderTexture attach="map" anisotropy={16}>
<PerspectiveCamera
makeDefault
manual
aspect={1 / 1}
position={[0, 0, 5]}
/>
<color attach="background" args={["orange"]} />
<DragControls axisLock="z">
<Circle>
<meshBasicMaterial color="red" />
</Circle>
</DragControls>
</RenderTexture>
</meshStandardMaterial>
</Box>Suggested solution:
It's clear to me that we need to be doing a raycast, but I'm still pretty new to threejs and 3d programming in general, so I don't really know where to start with implementing it.
Reactions are currently unavailable