Draw line from UI element to tracked image


#1

Hi, I’m trying to understand a simple way in ZapWorks Studio to draw a dynamically-updated straight line between an image positioned in screen space and an image positioned relative to a tracker (see attached picture for the general idea). I guess my question is twofold:

  1. The line I want to draw would be positioned in screen space but would need to be anchored on one end to an object positioned in 3D space. Is it possible to get the screen-space coordinates of an object positioned in 3D space (the “dot” in the picture)?
  2. How would one actually render the line? I’m guessing there’s no way to add a “stroke” to a bezier path?

Any thoughts on this would be appreciated, thanks!

Andrew


#2

Hey there,

Unfortunately there’s no simple way to do this as it would require interactions between the world-space and screen-space coordinate systems to determine the positions of objects relative to both of them.

Having to do this dynamically adds an extra layer of complexity.

This could potentially be achieved but would require a substantial amount of coding.

Also, depending on the angle calculated between the positions of the screen-space object and the world-space object, the line may not always be visible to the user.

A less complicated, and possibly more ideal, solution would be to have your information pop-ups also positioned relative to the tracking image.

This would give you much greater control of how they’re displayed.

Hope this helps, let me know if you have any other questions.

All the best,
Seb