Git Product home page Git Product logo

Comments (3)

BastiaanOlij avatar BastiaanOlij commented on July 17, 2024

This is a rather annoying problem in the core that we've only discovered recently and still aren't sure why it is happening. The positions of the camera and controller are updated behind the scenes inside their own process functions. Behind the scenes Godot maintains both the local transform of the object (relative to its parent) and the global position of the object (used for rendering).
If the position of the ARVROrigin is changed during _process but before the controller positions are updated, it seems to be using the old global position of the origin point to determine the new global position of the controller.

I never ran into this myself because I do all repositioning of the ARVROrigin node as a response to controller inputs which are handled in scripts on the controllers and the repositioning is thus applied after the tracking updates the position of the controllers and this delay does not happen and as a result this issue remained undiscovered for years as people based their projects on my code :).
Have a look at https://github.com/GodotVR/godot-xr-tools or the demo project on the OpenVR repo to see how that is put together.

If you do have a reason to have movement logic more central, say you're controlling your character with a gamepad, the easy workaround is just to implement that logic on a node added after the controllers, so:

ARVROrigin
  - ARVRCamera
  - ARVRController left
  - ARVRController right
  - ControlNode <-- implement _process here

Your other solution of doing it in _physics_process is also sound but yes, you have to ensure the update rate of physics is equal or higher than the refresh rate of your HMD. This is good practice anyway especially if your character is attached to a physics controlled entity like driving a car, or you'll get visible stuttering as the cars position isn't updated every rendered frame.

The head tracking is updated right before rendering but this isn't actually a problem because that does work correctly in relation to the origin point, here there is only a problem if you have child node on the ARVRCamera as they are not updated along side it.

This is all solved in Godot 4 where all tracking updates now happen before _physics_process and _process even run but this is not a change easily back ported to Godot 3.

The world_scale issue is also different, here the problem is that there isn't yet a mechanism for directly applying the new tracking transforms as a result to changing the scale. Still working on that one.

from godot_oculus_mobile.

clktmr avatar clktmr commented on July 17, 2024

Thanks for the in-depth response. This makes much more sense now.

The workaround is easily applicable to my use-case. Feel free to close this issue as wont-fix.

Since it was a known issue, is it documented elsewhere? I was surprised to not find anything about it, although I stumbled over it so early.

from godot_oculus_mobile.

BastiaanOlij avatar BastiaanOlij commented on July 17, 2024

There are issues on the main godot issue tracker for this but mostly it just comes up in discussions on Discord from time to time.
Most people either have physics control the player position (driving sims, flight sims), or have the logic on the controllers, so the problem doesn't eventuate. It actually wasn't until a few months back someone was able to provide me with a good example and suddenly the lightbulb went on.

It's a weird issue because it sounds like the way Godot updates the global transforms internally has an issue, I haven't had time yet to really dive into that part of the code yet but I'm guessing it doesn't update the global transforms immediately when you change an objects transform because it can be a very costly exercise when there are many transform updates in a larger tree of objects.

from godot_oculus_mobile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.