我在圆柱体上有一个图像,前面有这个丑陋的缝。颠倒的山缝
我试图将其精确地向后移动180度,但我无法旋转圆柱体本身。我遇到了这个话题,尽管也许有人可以帮助我。我已经尝试了每种组合来旋转图像,而获得的最好效果是图像没有失真。
我的代码是:
func addWalls(nodeName: String, portalNode: SCNNode, imageName: String){
let child = portalNode.childNode(withName: nodeName, recursively: true)
child?.geometry?.firstMaterial?.diffuse.contents = UIImage(named: "Portal.scnassets/\(imageName).jpg")
let translation = SCNMatrix4MakeTranslation(0, -1, 0)
let rotation = SCNMatrix4MakeRotation(Float.pi / 1, 1, 0, 0)
let transform = SCNMatrix4Mult(translation, rotation)
child?.geometry?.firstMaterial?.diffuse.contentsTransform = transform
child?.renderingOrder = 200
if let mask = child?.childNode(withName: "mask", recursively: false){
mask.geometry?.firstMaterial?.transparency = 0.000001
}
}
还有其他方法可以使此图像在电子管上旋转吗?任何帮助表示赞赏。