Unity USB Thrustmaster Joystick - unity3d

I am trying to use a USB Joystick in Unity.
I am working with Unity 5.5.1 on a Windows 10 PC. The Joystick works perfectly on my machine.
But in Unity, the joystick gives me some weird axis outputs.
I tried to map my joystick input with the Unity Input Manager. But it doesn't work at all.
On the horizontal axis I get values from -1 to -0.6(center) to 0 to +0.6 instead of just -1 to 0(center) to 1.
Another weird thing is, that everything works just fine on my macbook. Is this a windows issue?
Did somebody else had this problem before?

I have a torrid joystick that works perfectly everywhere except unity. I've solved my issue with input.getaxis().. not being 0 by watching what was the value when the controller was set in neutral position(0.14f) and when it was set on maximum position(1.14f), and with a simple modification to the script that said something like this input.getaxis()-0.14f I've solved my problem. however, I would not recommend doing that if you are going to publish your project because that offset will be different for every user, so I would suggest writing a calibration tool that would take the offset and implement in everywhere in the game for that specific user

Related

Unity Oculus Rift S - Unable to change camera's field of view

In my current project, I am using the Oculus Integration package to interface my app with my Oculus Rift S headset and Unity 2021.3.6f1 URP.
While working on the project I played with the camera settings to get better visuals, and noticed that the field of view attribute always goes back to 90 (even when I set it at run time).
I went over the scripts that were imported from the Oculus package, mainly the following ones (since those are the ones used in the project): OVRCameraRig, OVRManager, OVRHeadsetEmulator.
But wasn't able to find anywhere in the code what is the cause. I even tried searching through all the scripts (using my IDE) for any piece of code that changes the fieldOfView property, and found some scripts but none of them is used in the project, and commenting those lines made no difference…
So, my question is why can't I change my camera's field of view? What caused it to constantly be set to 90?
Its a bad idea to change the default FOV on a VR camera - its meant to match the actual FOV of the headset and most users will experience heavy nausea if you change it more than a few degrees from the correct value. If you want to experience just how bad this feels, place a quad in front of the main camera, with unlit textured material with a texture written to from another camera (with a different fov). This simple solution will not give you stereoscopy, but should be enough to experience just how bad of and idea this is

Hololens 2 Gaze cursor not executing buttons

We're working on Hololens 2 and have created our own Button design, where we followed a MRTK Tutorial.
Now sadly we cannot execute the buttons using the Gaze-cursor in Hololens 2.
We are using our own Configurationprofile, but the same is valid when using the defaultHololens2configurationprofile.
Also there is a weird behaviour (Valid for both profiles mentioned before): When starting the app the Gaze-cursor is visible, the moment my hands are recognized the gaze-cursor disappears (all good until now), but when I move my hands behind my back the gaze-cursor doesn't appear anymore.
Does anybody have a similar problem, knows how to solve it or has observed something similar?
We are using:
Unity 2020.3.6f1
MRTK 2.7.0
All XR Packages up to date, except XR Plugin Management 4.0.1
Here some screenshots which components our buttons have attached:
Cheers and thanks for the help
The reason is that MRTK is currently designed in a way that at a distance hand rays act as the prioritized focus pointers, so the eye gaze is suppressed as a cursor input if hand rays are used.
If you want to use both eye focus and hand rays at the same time, please follow this documentation:Use hand rays and eye-gaze input together. However, in this way, voice command will be the only method to interact with the hologram which focusing on.
Besides, if you want to support a 'look and pinch' interaction, you need to disable the hand ray according to this document:How to support look + hand motions (eye gaze & hand gestures)
I filed the following GitHub issue and it's being investigated - "Select" voice command does not fire the appropriate events when using OpenXR on HoloLens 2

Hololens2 + Vuforia ImageTarget. Tracked Image has a position offset

I'm having an issue with a project built in Unity for Hololens 2, using
MRTK 2.7.0
OpenXR 1.0.0
Vuforia 9.8.8
Unity 2020.3.10f
The MRTK is installed using the MRTK feature tool. I installed foundations, extensions, toolkit tools and standard assets.
The Vuforia ImageTargets get a random offset from their supposed position.
I have the scene, hand tracking and the general setup for the Hololens running as intended using the MRTK. I also want to utilize the image tracking capabilities of Vuforia, but thats where my issue comes in. When starting the app on the Hololens 2 device, the ImageTargets are getting detected, but their position has a random offset, after each restart of the app. I suspect that the World coordinate system is slightly off. In the Vuforia behaviour, the World Center mode is already predefined to DEVICE and cannot be changed.
When testing in the Editor with a Webcam, everything is working as expected.
The scene is setup similar to the tutorial found at https://arvrjourney.com/hololens-2-marker-tracking-with-vuforia-engine-and-mrtk-fb582c8f8ac0
My scene hirarchy looks as follows, which is similar to the scene setup found in the Vuforia Hololens 2 samples
One of the Targets has no child, but it is actually toggling another scene gameobject, after detection and then switching over to extended tracking to use the more stable tracking of the Hololens. The SceneGameobject is following the Imagemarkers position. To verify the behaviour, there is also a second marker, with a default setup and a cube as a child. Both show the same behaviour and same offset.
I also tried to change the Image Targets' place in the hirarchy, like putting it as a child of the Playspace, or the Maincamera, to no avail.
TLDR: Vufora Image Targets do not work when using OpenXR on the Hololens 2
EDIT: I changed from OpenXR back to Windows Mixed Reality, which seems to have eliminated the issue, but I'm really puzzled about it nonetheless, especially, when OpenXR is supposed to replace Windows Mixed Reality in the future o.O
This was a problem that was caused by Vuforia not fully supporting OpenXR. As of version 10.4.4, they have fixed the problem.
If you were like me and came to this question because you were implementing your own image tracking service and suddenly there was an offset caused by updating to Unity 2020 and/or OpenXR, it's likely you are encountering the same problem Vuforia had to fix. I fixed it by changing how I am obtaining the world origin:
The proper way to obtain the world origin in OpenXR is using:
using Microsoft.MixedReality.OpenXR;
var worldOrigin = PerceptionInterop.GetSceneCoordinateSystem(Pose.identity) as SpatialCoordinateSystem;

How to get mobile yaw angle for Unity gyroscope?

I use Unity remote 5 to connect my phone to the Editor. I am reading the values Input.gyro.attitude.eulerAngles and am some-have confused. Because not matter how I orient my device, all angles change. I was hoping to get specific one that reflects the camera yaw rotation. Angle that would change only if I rotate my device like in image below and stay constant if I rotate it differently.
P.S. When I observe Debug.Log(gyroInp.attitude.eulerAngles), the Z angle keeps growing even phone stands still on table. From 276 to 350 and continues to grow. Is it because the earth is turning? :)
Unity Remote 5 (UR5) seems to be broken for reading gyro as indicated by this (more specific) issue in Unity's issue tracker: https://issuetracker.unity3d.com/issues/ios-13-dot-0-rotations-around-device-y-axis-does-not-work-when-rotating-a-device-and-using-remote
If I use the UR5 to read gyro attitude/acceleration in the editor it gives an initial value that is never updated but only repeated for each read after that. The actual build on my (iOS 14) device works as expected.
So the Unity Remote 5 is unfortunately broken for all things gyro, it may be an iOS specific issue.

Unity3d 5 Direct Input

I have an issue in Unity3d v5 where my joystick does not work as intended, When i plug in the joystick, moving it right from the center, gives me -1 and up to 1.
Keeping it completely center, gives me 1 and moving it left gives me 1 (so no change in value moving stick left.
From what ive read it has to do with using RawInput and not using DirectInput.
I have read a post where someone suggests using a registry change to force unity to use directinput. But it does nothing for me using unity3d v5.
Can anyone please help me, because i am completely stuck on this and getting this joystick to work is essential for my game :)
It's very difficult to find any information about this issue from an official Unity source, but take a look at the answer here: Joystick not working
And follow through the threads referred to there. The upshot of this all is that RawInput is all you can rely on for joystick input, on windows. The best solution to this problem I can think of is runtime calibration in your game/app. If you don't care to implement that yourself, there are 3rd party options such as this one, that integrate with Unity: cInput 2
I am running into this same problem with my Unity projects, and my plan is simply to present joystick users with the option to calibrate. You could save the calibration settings so the user doesn't have to calibrate every time the game is run. Not ideal, but again the most realistic solution to the problem I can come up with.