ARKit –将物体隐藏在墙后

时间:2019-04-02 17:17:25

标签: ios swift xcode arkit

我对AR应用程序有个主意,我注意到在大多数AR应用程序中,对象不是通过墙隐藏的,例如,是否有可能将AR肖像钉在我的房间里,并且只有在我去那里,不是穿过墙壁吗?

我没有AR方面的经验,只是要学习它。

谢谢。

2 个答案:

答案 0 :(得分:0)

这是执行此操作的简单方法,您必须检测平面(在您的情况下为墙)并设置

mounted () {
      this.$nextTick(function () {
        this.UserImage = localStorage.Image
        this.UserName  = localStorage.Name
    })
  },

答案 1 :(得分:0)

您可以使用三种不同的墙创建方法轻松地将所有对象隐藏在墙后:SCNBox(),带有挤压的SCNShape()或SCNGeometry()。无论选择什么,只需为其分配空的实例属性.colorBufferWriteMask。并且.renderingOrder实例属性必须为-1。呈现顺序为负值的节点将首先呈现。

let wallNode = SCNNode()
wallNode.geometry = SCNBox(width: 15.0, height: 3.0, length: 0.1, chamferRadius: 0)
wallNode.position = SCNVector3(x: 0, y: 0, z: 5)

//wallNode.geometry = SCNShape(path: NSBezierPath?, extrusionDepth: CGFloat)
//wallNode.geometry = SCNGeometry(sources: [SCNGeometrySource], elements: [SCNGeometryElement]?)

wallNode.geometry?.firstMaterial?.colorBufferWriteMask = []
wallNode.renderingOrder = -1
scene.rootNode.addChildNode(wallNode)

希望这会有所帮助。

相关问题