1

I know that if I'm using ARSCNView (i.e. SceneKit), I can draw a line using something like a cylinder since SceneKit has a 3D environment and drawing something between two 3d points is supported natively.

However, I'm trying to create an interface like Apple's measure app:

enter image description here

The rendered elements (e.g. the line and the 3'3") don't look 3D, so I was thinking I should use ARSKView (i.e. SpriteKit) for this. Placing a single element such as the emoji in Apple's ARKit + SpriteKit template is pretty trivial, since you simply need to implement the method:

func view(_ view: ARSKView, nodeFor anchor: ARAnchor) -> SKNode? {
    return SKLabelNode(text: "")
}

This associates a 2D object (SKNode) with a 3D position (ARAnchor).

What I can't figure out how to do is how to draw a line between two nodes.

Is there any way to draw a line between two nodes like in the image above using SpriteKit, or must we switch over to SceneKit to achieve this effect?


Note: This is not a duplicate of the following questions since those questions talk about SceneKit (3D), not SpriteKit (2D):

Senseful
  • 86,719
  • 67
  • 308
  • 465

0 Answers0