ExtendRealityLtd / Tilia.Interactions.Interactables.Unity

A variety of mechanisms for interacting between interactors and interactables in a spatial scene for the Unity software
MIT License
9 stars 3 forks source link

grabbing interactable with ui canvas on it, ui lags behind #21

Closed fight4dream closed 3 years ago

fight4dream commented 4 years ago

Steps to reproduce

  1. create a world space canvas
  2. create a cube interactable object
  3. parent the canvas to the cube and position it to the face of the cube
  4. grab and move the object around

Expected behavior

the canvas should follow the cube

Current behavior

the canvas lags behind the cube

Solution

add a moment to MomentProcessor which uses https://docs.unity3d.com/ScriptReference/Application-onBeforeRender.html if the cube and canvas are both updated positions in this moment, the canvas stays with cube

for additional info this moment is justified and may affect our users, i know steam vr plugin 2017+ also updated to use this moment https://github.com/ValveSoftware/steamvr_unity_plugin/blob/master/Assets/SteamVR/Scripts/SteamVR_Behaviour.cs#179 https://github.com/ValveSoftware/steamvr_unity_plugin/blob/master/Assets/SteamVR/Scripts/SteamVR_Render.cs#319

thestonefox commented 4 years ago

Is there a SRP equivalent too?

fight4dream commented 4 years ago

I am afraid SRP is beyond my knowledge I can see there is a RenderPipelineManager.beginFrameRendering . but I don't know how it behaves against the canvas https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Rendering.RenderPipelineManager.html

thestonefox commented 4 years ago

As we've started supporting the SRP moments now, we can't add additional moments that will break SRP otherwise it will just cause confusion. If anyone knows the answer then please post here. @reznovVR may be able to help perhaps?

reznovVR commented 4 years ago

Yeah it seems it would be possible to support both, built-in and SRP.

However the Application one says "Any work performed within this callback will increase the latency between sampling input and rendering to the device. It is important to keep the amount of work done in this callback to a minimum.". Isn't there typically several moment processors running?

fight4dream commented 4 years ago

@reznorVR can you confirm or deny the UI lag happens in SRP also?

Tbh even for a regular Update(), the same warning applies, or your framerate will be dropped