mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
103.08k stars 35.41k forks source link

WebXR: Bend ray gizmo on interaction. #25620

Open FluorescentHallucinogen opened 1 year ago

FluorescentHallucinogen commented 1 year ago

Description

The current behavior in WebXR is that ray is always a straight line.

Solution

The ray bend while wobbling or selecting and pulling, like a lasso. See the Mixed Reality Toolkit (MRTK) behavior:

https://user-images.githubusercontent.com/7892779/222918322-b5b78de6-2030-41e2-b4c7-5ccd61781525.mp4

Alternatives

I don't know, you tell me.

Additional context

No response

FluorescentHallucinogen commented 1 year ago

Can this be easily achieved by just using THREE.QuadraticBezierCurve3? 🤔

Mugen87 commented 1 year ago

I think one problem is that in examples like webxr_vr_ballshooter the ray is just a simple line attached to the controller. In your video, you need additionally the intersection point of the ray and at least one control point to compute the final bent curve.

Getting the intersection point is easy but I don't know how to derive the control point. This one obviously depends on the direction and strength of your drag interaction.