GodotVR / godot_oculus_mobile

Godot Oculus mobile drivers (Oculus Go / Oculus Quest)
MIT License
169 stars 34 forks source link

The controller positions do not handle world_scale correctly #103

Closed goatchurchprime closed 4 years ago

goatchurchprime commented 4 years ago

If you set the ARVROrigin world_scale to 2, then the hand controllers are up in the sky and move past you at twice the speed you walk.

It looks like their positions need to be scaled down towards the centre of the tracking space by a factor or 2=world_scale.

This parameter works correctly on the Vive -- the hand controllers are where they should be, while the world is smaller. In my demo was scaling by a factor of 4 in order to have smaller voxels in the voxel terrain library.

goatchurchprime commented 4 years ago

Also, making this work and deploy to android/quest was a lot of hassle. The final impossible step (I needed to ask help on) was to create an empty settings.gradle file inside godot_oculus_mobile\demo\android\build for no reason.

m4gr3d commented 4 years ago

@goatchurchprime The deployment bugs have been resolved in the Godot 3.2.2 (still in beta).

@BastiaanOlij Any thoughts about the scaling issues?

BastiaanOlij commented 4 years ago

@m4gr3d I'll take a look tonight but it's either calling the wrong setter or not taking the scaling into account. Basically all the places where we're getting transforms from Oculus we need to scale the position correctly and in game you need to scale controller meshes.

BastiaanOlij commented 4 years ago

Ah, it's applying the worldscale double. It's applied in the call to godot_transform_from_ovr_pose here: https://github.com/GodotVR/godot_oculus_mobile/blob/master/plugin/src/main/cpp/ovr_mobile_controller.cpp#L211

But then on the next line where the transform is sent to Godot by calling godot_arvr_set_controller_transform, that also applies the world scale.

So we can just set the first call to 1.0, I'll do a PR in a minute