如何使用 SceneKit 从 AR 中的点生成多边形平面

问题描述 投票:0回答:0

用户在地板(角)上放点,组成一个图形,比如六边形(图形可以是任意的)。有必要创建一个平面,这将是这个人物的地板。 因此,输入数据是一组具有

[SCNVector3]
类型的点。 我考虑过一些解决方案:

  1. Create your own geometry, using
    SCNGeometryElement
    where we pass the vertex indices and render method (in my case a triangle), but this will need to write their own method of triangulation (因为我可能是多边形), 我注意到这种方法在三角形之间留下“接缝和缝隙”,它不适合我,因为需要应用纹理
  2. 通过
    UIBezierPath
    SCNShape
    创建几何体,这种方法完美地创建了我需要的形状,但问题是它只是在空间中创建它,而我需要这个地板在点之间。

所以我需要一个解决方案,它可以从一组点中为我创建一个相同形状的图形,并在正确的位置。有人有什么想法吗?

ios swift scenekit arkit
© www.soinside.com 2019 - 2024. All rights reserved.