동일한 위치에서 내 프로젝트에 2 개의 구체가 있습니다. firstSphere는 작고 tempSphere는 더 큽니다.장면 킷의 두 구체의 크기를 비교하는 방법은 무엇입니까?
편집 : firstShape는 tempShape보다 크게 커집니다. 나는 내가 좋아하는 테스트를 위해 노력하고있는 firstShape 일시 중지하면 '경우를 firstShape.scale == tempShape.scale'
//Create Shape
let firstShapeGeo = SCNSphere(radius: shapeRadius)
firstShape.geometry = firstShapeGeo
let shapeMaterial = SCNMaterial()
shapeMaterial.diffuse.contents = UIColor(colorLiteralRed: 0.2, green: 0.8, blue: 0.9, alpha: 1.0)
firstShapeGeo.materials = [shapeMaterial]
firstShape.position = SCNVector3Make(0, 0, 0)
scene.rootNode.addChildNode(firstShape)
firstShape.name = "\(shapeNumber)"
// Create Temp Shape
tempShapeRadius = shapeRadius + 1.0
let tempShapeGeo = SCNSphere(radius: tempShapeRadius)
tempShape.geometry = tempShapeGeo
let tempShapeMaterial = SCNMaterial()
tempShapeMaterial.diffuse.contents = UIColor(colorLiteralRed: 0.2, green: 0.8, blue: 0.9, alpha: 0.5)
tempShapeGeo.materials = [tempShapeMaterial]
firstShape.position = SCNVector3Make(0, 0, 0)
scene.rootNode.addChildNode(tempShape)
이 나는 작은 영역이 성장하고 firstSphere
let grow = SCNAction.scale(to: tempShapeRadius * 2 + 1, duration: 1)
let shrink = SCNAction.scale(to: tempShapeRadius, duration: 1)
let sequence = SCNAction.sequence([grow, shrink])
firstShape.run(SCNAction.repeatForever(sequence))
성장하고 어떻게 큰 숫자는 SCNAction.scale
을 사용하여 반경이 실제로 변하고 있다고 생각하지 않습니다. 이것이 당신이 알아야 할 것이면 확실하지 않습니다.
은 어떤 도움이 많이 주시면 감사하겠습니다! 감사!
규모를 비교하는 방법의 예를 보여줄 수 있습니까? 처음에는 규모 비교를 시도했지만 오류가 계속 발생하는 것으로 보입니다. –
코드 스 니펫에 내장되어 있습니다. 'grow'은 'firstShape'의 크기를 'tempShape'의 크기가 될 때까지 '1'로 낮추어 원래의 값으로 변경합니다. – bpedit
죄송합니다. 나는 그 질문에서 분명하지 않았습니다. firstShape는 tempShape보다 약간 크게 커집니다. 'firstShape.scale == tempShape.scale'과 같이 테스트하려고합니다. 질문이 업데이트됩니다. –