У меня есть SCNPlane
и две координаты (SCNVector3
). Который я получил от теста удара против другого SCNPlane
(стена)
Я пытался нарисовать SCNPlane
с расстоянием между ними, но SCNPlane
не запрашивает ширину между двумя точками.
Вот что я пробовал:
guard let nodesWithDistance = self.getLastTwoNodeWithDistance(linkList: self.linkList) else {return}
print(nodesWithDistance) // This will return last two nodes with distance between them which is `sqrtf((vector1.x - vector2.x) * (vector1.x - vector2.x) + (vector1.y - vector2.y) * (vector1.y - vector2.y) + (vector1.z - vector2.z) * (vector1.z - vector2.z)`
let node = SCNNode(geometry: SCNPlane(width: CGFloat( nodesWithDistance.distance) , height: CGFloat(nodesWithDistance.distance) ))
node.geometry?.firstMaterial?.isDoubleSided = true
node.name = "TV"
node.geometry?.firstMaterial?.diffuse.contents = UIColor.red.withAlphaComponent(1)
node.renderOnTop()
node.geometry?.firstMaterial?.diffuse.contents = UIColor.red.withAlphaComponent(1)
node.position = nodesWithDistance.previous.node.mainNode.position
node.eulerAngles = first.node.eulerAngles
self.sceneView.scene.rootNode.addChildNode(node)
Смотрите снимок экрана
![screenshot](https://i.stack.imgur.com/0DBDy.png)