Hi,
I am trying to log bumper presses and trigger press values (bool and float respectively). Sometimes the log files output the values as expected, other times, when I run the app, I only get 0s or False values, even though I pressed the buttons. I am confused as to what is happening here, and why this is variably working.
Here is how I am logging the controller data:
In Start():
// Initialize the InputActionAsset
_magicLeapInputs = new MagicLeapInputs();
_magicLeapInputs.Enable();
//Initialize the ControllerActions using the Magic Leap Input
_controllerActions = new MagicLeapInputs.ControllerActions(_magicLeapInputs);
The triggerValue and bumperPressed are then passed into a string builder which is output into a file.
The following is also added to the logging script game object:
Any tips as to what I might be missing please (ie. what might cause it to not always work)? For contrast, in the same file I am also logging eye data, and that always works.
Hi @etucker, thanks for the info.
I cannot really provide any replication steps as it is rather random when it worked or not. For the past days, the logging for the controller has not worked. I am now printing _controllerActions.IsTracked.IsPressed() in Update() and it returns False. I am wondering whether I am missing some library steps or hardware steps. My project is built on the original example project so it has everything included. The controller is connected, I can even get the vector line (the white line MRTK provides) from its position and into the world at any time.
So I did try to replicate this issue. It seems I can't reproduce it after multiple tries. Have you tried taking a look at the Logcat output using the editor, it may be an issue with the logging of data.
I assume you are using the OpenXR workflow in your project? Can you verify that you are using the Input Action Asset that is meant for OpenXR?
The Magic Leap Example project contains an Input Action asset inside the root Assets folder called MagicLeapInput and not MagicLeapInputs (notice the lack of the S at the end).
You will need to generate the C# scripts associated with the MagicLeapInput Asset and then change your references accordingly.
You can also see more information and other methods of getting controller input in our developer documentation: