ARKit鈥Howtocustomize(geometry)SCNBox?
创始人
2024-09-13 13:00:56
0

要自定义 ARKit 中 SCNBox 的几何形状,可以使用以下代码示例:

// 创建一个 SCNBox,并设置自定义几何形状
let box = SCNBox(width: 0.1, height: 0.05, length: 0.15, chamferRadius: 0)
// 自定义 SCNGeometrySource 中的顶点
let vertices: [SCNVector3] = [
    SCNVector3(x: 0, y: 0, z: 0),
    SCNVector3(x: 0, y: 0.1, z: 0),
    SCNVector3(x: 0.1, y: 0, z: 0),
    SCNVector3(x: 0.1, y: 0.1, z: 0),
    SCNVector3(x: 0, y: 0, z: 0.15),
    SCNVector3(x: 0, y: 0.1, z: 0.15),
    SCNVector3(x: 0.1, y: 0, z: 0.15),
    SCNVector3(x: 0.1, y: 0.1, z: 0.15),
]
let vertexSource = SCNGeometrySource(vertices: vertices)
box.geometry?.setGeometrySources([vertexSource], for: .vertex)
// 使用自定义的顶点索引更新 SCNGeometryElement 中的三角形索引
let vertexIndices: [UInt16] = [0, 1, 3, 3, 2, 0, 2, 3, 7, 7, 6, 2, 6, 7, 5, 5, 4, 6, 4, 5, 1, 1, 0, 4, 4, 0, 2, 2, 6, 4, 1, 5, 7, 7, 3, 1]
let indexData = Data(bytes: vertexIndices, count: MemoryLayout.size * vertexIndices.count)
let element = SCNGe

相关内容

热门资讯

透视教学!aapoker脚本怎... 透视教学!aapoker脚本怎么用,安装不了wepoker,必备教程(最初存在有挂)1、玩家可以在a...
透视系统!红龙poker透视工... 透视系统!红龙poker透视工具,wepoker透视脚本苹果版,wpk教程(从来存在有挂);wepo...
透视线上!hhpoker辅助软... 透视线上!hhpoker辅助软件下载,wepoker辅助脚本,细节揭秘(从来存在有挂);一、hhpo...
透视软件!智星菠萝辅助怎么买,... 透视软件!智星菠萝辅助怎么买,pokemmo脚本最新版,安装教程(一向是真的有挂);智星菠萝辅助怎么...
透视脚本!德普之星有没有挂,约... 透视脚本!德普之星有没有挂,约局吧辅助器,教你攻略(原生有挂);致您一封信;亲爱德普之星有没有挂玩家...
透视新版!智星菠萝辅助,有没有... 透视新版!智星菠萝辅助,有没有人wepoker,实用技巧(一直存在有挂)是一款可以让一直输的玩家,快...
透视脚本!wepoker透视脚... WePoker透视辅助版本稳定性对比与推荐‌:透视脚本!wepoker透视脚本苹果,拱趴大菠萝作弊方...
透视总结!aapoker透视怎... 透视总结!aapoker透视怎么用,wepoker辅助器有哪些功能,新版2025教程(原本是有挂);...
透视透视!hhpoker辅助下... 透视透视!hhpoker辅助下载,hhpoker是真的假的,解密教程(从来有挂)准备好在hhpoke...
透视玄学!aapoker辅助插... 透视玄学!aapoker辅助插件工具下载,hhpoker是内部控制吗,安装教程(果然存在有挂);aa...