Updating Actor transform during tick is off from position of motion controller

I am relatively new to Unreal Engine, and am attempting some programming with the HTC Vive. I have followed the instructions of the following link to get started, and everything worked as expected:

https://docs.unrealengine.com/latest/INT/Platforms/VR/MotionController/

What I want to do currently is place spheres in the world using the motion controller, and connect them with lines. I have the sphere placing, and connecting lines part done. I use a blueprint actor for the line, with a static mesh, and create instances of it using SpawnActor. Then modify the transform of it to connect the spheres. This all works well for the spheres that are already placed.

The problem is the line between the last sphere placed, and the pending sphere still attached to the MotionController component. While the controller trigger is held, I attach the sphere actor to the MotionController component. I spawn an actor of the line, and update its transform during the tick of the VR_Pawn actor by retrieving the location of the sphere actor attached to the MotionController component. When the controller is held still, the line actor’s transform is correct. When the motion controller is moved, however; the line seems to connect the last placed sphere, and the place that the MotionController sphere was last frame.

I’m not sure I 100% understand your problem but it seems like it may be relevant that the MotionController does a “LateUpdate” right before rendering. It calculates the delta transform from the “normal” update (in TickComponent) to the “late” update (in PreRenderViewFamily_RenderThread) and then adjusts itself and all its children accordingly at the last millisecond.

The end result is that the MotionControllerComponents (and any PrimitiveComponents children) are rendered w/ lower latency. Unfortunately, this means that if you query the Transform of the MotionController before the end of the frame (ex. TickComponent, or basically any other time) it won’t align with where the MotionController is actually rendered (unless it isn’t moving).

I’m wrestling with similar issues, and if it is the same thing you could try -

  1. Tick “DisableLowLatencyUpdate” on the MotionControllerComp in your Blueprint or set bDisableLowLatencyUpdate=true from C++
  2. Via console - “vr.EnableMotionControllerLateUpdate 0”

If either of those fix your problem, I’m glad to have helped. Unfortunately this will add quite a bit of latency to your MotionControllers. To keep the LateUpdates and fix your issue, you will need to set your line end-point after the MotionController has been LateUpdated. This will be difficult as the LateUpdate happens very shortly before rendering begins, and on the Rendering thread (so most UE methods are unsafe to call at that point). I would guess your best bet would be to to generate the line geometry on the GPU - basically have a “LateDrawLineComponent” derived from PrimitiveComponent and parented under the MotionController - then in its material’s geometry shader (on GPU) generate the line back to the fixed start point (previous sphere, which is not moving and can thus be configured CPU side from a stable and early function like “TickComponent”). The line start point would be a shader variable and the end point would be the LateDrawLineComponent’s position (late updated thanks to being under MotionController).