DragControls questions

i see that DragControls dispatches the “dragstart” and “dragend” events.

in this attached image i am trying to listen to those events, but nothing is getting console logged when i drag a sphere. Any ideas why?

In the unity editor i have:

  1. basic XR Rig
  2. GameObject that is just a sphere containing DragControls and my component i created in attached image

Original Post on Discord

by user 352282921056468993

Sorry I just saw your post - the DragControls components is using some old code for those and you need to use dragControls.addDragEventListener

hmm i replaced addEventListener with that method and still not seeing the console logs. DragControls is successfully initialized. but dispatched events are not being detected

by user 352282921056468993

is ObjectRaycaster needed somewhere in the scene for this to work? I have the basic XRRig, but not ObjectRaycaster. If it is needed, where does it go?

by user 352282921056468993

Ah i just realized it detects drag events when using mouse, but not drag events when using a VR controller…wonder why

by user 352282921056468993

Ahh okay - so looks like addDragEventListener is good for detecting a mouse drag. Looks like onPointerEnter and onPointerExit (which are also on DragControls) can be used for detecting VR controller interactions

by user 352282921056468993

Looks like an oversight on our end - thanks for the additional details!