I would like to know about how getting WMR controller position and rotation with MRTK on Unity.
Scenario: Object picked up by one of the controller(Left/Right), and object will follow the position & rotation of the controller.
Current State
I can trigger the grab/pick event and validate the handedness (R/L). This is sample of my basic code:
public class WeaponControl : MonoBehaviour, IMixedRealityInputHandler
{
private Handedness pickedHand;
private bool isPickedUp = false;
public void OnInputDown(InputEventData eventData)
{
if(eventData.InputSource.SourceType == InputSourceType.Controller && isPickedUp == false)
{
Debug.Log("Left Hand");
isPickedUp = true;
pickedHand = eventData.Handedness;
}
}
public void OnInputUp(InputEventData eventData)
{
//throw new System.NotImplementedException();
}
/// Method on tracking controller below
///
}
Goal
Tracking position and rotation of selected controller