Announcement

Collapse
No announcement yet.

How to work with Low Latency Update in MotionController?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to work with Low Latency Update in MotionController?

    I'm creating some dynamic geometry (using the Procedural Mesh Component) which is meant to be attached at one end to a MotionController, and the other end to a target in the world.

    It all works great, except that where the geometry is meant to be attached to the MotionController is always lagging behind the actual position of the controller. I now understand this is due to the 'Low Latency Update' applied to the MotionController, so it's position is updated outside of the main loop where I'm accessing it's position.

    If I check 'Disable Low Latency Update' in the MotionController, then the problem goes away. Perhaps that's fine...? Certainly it seems to make no difference on my machine, but I have a pretty beefy setup and I'm wondering firstly whether disabling the low latency update is likely to cause any issues for people? What are the disadvantages to turning it off in practical terms?

    I would rather not have to disable it though, so I'm trying to figure out what I can do about that. Obviously, if you attach a mesh (for example) to the MotionController, it maintains the correct position and doesn't lag behind it. But if I attach my Procedural Mesh component to the MotionController, that means I now have to transform the target locations of the mesh vertices from world space to the local space of the motion controller. Attempting to do this, even if the Procedural Mesh is attached to the controller, still suffers from the lag. My guess is that the Procedural Mesh drawing routine still operates inside the main loop, and is not allowed to operate in the late update...?

    Here is an example illustrating the problem:

    Suppose I attach a sphere static mesh to the MotionController, but I want to keep the mesh at a certain point in world space rather than have it moving around attached to the controller. (This is obviously a weird thing to do, because you could just not attach the sphere to the controller in the first place and put it where you want in the world. But this illustrates the problem regarding what I need to do with a procedural mesh).

    So on tick I need to invert the transform of the motion controller to bring it back into world space (this places it at {0,0,0}):




    Here's what this looks like with low latency update enabled:





    And disabled:





    So my question is: is there any way to achieve this kind of effect without needing to disable the low latency update?

    #2
    Late updates are a naive positional update on the render thread, there is no reason to try and run custom logic for staying in place like that when you can just toggle the setting on/off dynamically to achieve the correct result. It doesn't have to be a static choice in the editor, you can change the value at run time.

    If you DID need custom logic, it would be a little harder as you will have to change the modifying matrix that is created, which currently is just the delta from last known position to the position on the render thread when polled late.

    For my controllers I don't even attach to them, I run a separate list of primitives that are added to the late update list and I remove/ add to that list depending on what I desire at the time with the object, since I support multiple gripped objects at a time flipping the state of late updates on the controller itself is undesirable.


    Consider supporting me on patreon

    My Open source tools and plugins
    Advanced Sessions Plugin
    VR Expansion Plugin

    Comment


      #3
      Ah, OK, I see what you mean, it's possible to change the low latency update dynamically at runtime. So my question remains how much of an actual negative effect doing that actually has?

      I'm curious what you mean by adding things to the late update list - how do you do that?

      Thanks for your response!

      Comment


        #4
        Originally posted by localstarlight View Post
        Ah, OK, I see what you mean, it's possible to change the low latency update dynamically at runtime. So my question remains how much of an actual negative effect doing that actually has?

        I'm curious what you mean by adding things to the late update list - how do you do that?

        Thanks for your response!
        It has no negative effect, it just skips the late update for the frames that the boolean is true (at least in 4.19, i forget how it handled it in 4.18 and below).


        As for the list, its a custom motion controller class with overidden behavior.
        Last edited by mordentral; 04-04-2018, 03:54 PM.


        Consider supporting me on patreon

        My Open source tools and plugins
        Advanced Sessions Plugin
        VR Expansion Plugin

        Comment

        Working...
        X