我看到WWDC 2013幻灯片有这个例子,我尝试使用SCNGeometrySource。 这是我的代码
var box = SCNBox(width: 10, height: 10, length: 10, chamferRadius: 0)
box.widthSegmentCount = 3
box.heightSegmentCount = 3
box.lengthSegmentCount = 3
let positionSource = box.getGeometrySources(for: .vertex)[0]
positionSource.vectorCount
positionSource.data.withUnsafeBytes{(vertexBuffer: UnsafePointer<Float>) in
print("a")
let a = positionSource.componentsPerVector
for i in 0..<positionSource.vectorCount {
print(SCNVector3(vertexBuffer[i * a], vertexBuffer[i * a + 1], vertexBuffer[i * a + 2]))
}
}
我想要做的是在这些位置添加这些球体,我可以在游戏中使用这些球体进行hitTest。所以我想在任何其他几何图形中添加球体,如图像。