Stylus position on Unity Scene


Hello. I have problems trying to render the stylus beam on Unity. Even in the examples provided, it has a certain angle which is really disorienting for the users, since the stylus tip isn’t accurately represented on screen. Do I have to use the native functions of the plugin instead of using the provided Unity Script to correct this issue? I have been reading other questions here, and it seems I need to redefine the viewport, but I have no idea how to do that with the provided Unity Script, since it does it automatically. Thanks for your attention.



Hi Jacuna,

The issue you’re experiencing doesn’t sound right. There shouldn’t have to be any manual intervention of the viewport to make the stylus display correctly with the Unity zCore plugin. Could you describe the specific circumstances which lead to a disorienting stylus?



Sorry, I didn’t explain very well my problem at hand. This happens when head tracking is disabled and / or the scene has fallen back from stereo to mono rendering. The stylus remains at an angle. I tried moving the camera, but the stylus remains at an angle in relation to the mono rendered scene, and also tried rotating the stylus position but it doesn’t work as expected (I see in the debug gizmos that the camera viewport and the display representation don’t quite match up, and the mismatch results in the stylus beam not being accurately displayed in mono mode). I have the requirement to be able to use the app even if stereo is not enabled or when the glasses are not in use due to some users reporting having headaches for using stereo, and they still want to use the stylus for operating the app, because of its 6dof.

Edit: Further testing, with head tracking enabled but stereo disabled, shows me that the Stylus direction, returned by the plugin, is dependent of the display angle and the glasses position. Is there some assumed glasses’s position when head tracking is disabled or the glasses are out of range?



I see. Well, without at least the glasses to track the users head, there’s no way for the stylus or the overall scene to align with the users perspective and stylus interaction therefore won’t be intuitive. The best advice I can give would be to maintain that the user must wear the glasses, and disable stereo by setting the IPD value to zero. That way the head is still tracked and the stylus can maintain some semblance of alignment with real space. If you absolutely need the stylus to make sense without glasses, then you’re in uncharted territory and will have to get creative.

Yes, when the glasses are out of tracking range, the stereo camera tracks back to a default centered position. I recommend taking a look at ZCore.cs “ComputeDefaultHeadPose()” to get a sense of how its coming up with the coordinates for that position.



Thank you Alex. With this bit of info we can, at least, re-evaluate the scope of that particular requirement.