问题
Does someone can help me?
I saw that the WWDC 2013 slide has this esample and I try it, using SCNGeometrySource . this is my code below
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]))
}
}
What I want to do is add those spheres at these position and I can do hitTest with these spheres in my game. So I want to add spheres in any other Geometry like the image.
来源:https://stackoverflow.com/questions/41983862/add-spheres-at-these-points-of-the-special-scnbox