MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Is there way to access controller transform from InputEventData?

Open ChauNTran opened this issue 7 years ago • 2 comments

I'm trying to write a simple grabbing mechanics script that set a gameobject is child of the controller when a controller. Currently I access the controller transform on OnTriggerEnter but the problem is the most recent controller that enter the gameobject trigger is not the one that sends most recent input.

Is there a way to access controller transform from InputEventData? If not, I guess I can use InputEventData.Handedness to find which controller fired the input but I still don't know how to access the controller transform. Thanks!

ChauNTran avatar Apr 04 '19 20:04 ChauNTran

The input data is the pure data coming from the device itself. To get the controller transform you'll need to get it's visualizer. It's been a while, and the code may have changes since I last seen it, but you should be able to query the input system for the controller by its input source id, and then access the visualizer that way.

StephenHodgson avatar Apr 05 '19 03:04 StephenHodgson

Thanks for responding. I was not able to find a way to query for controller with input source id, but I can use ControllerFinder to work around that.

ChauNTran avatar Apr 05 '19 15:04 ChauNTran