I don't understand how node scaling on nodes work.
I'm trying to understand how the code on Apple's Creating Face Based AR Experiences sample project works. Specifically, I'm trying to understand the TransformVisualization.swift file and the transformations applied to its nodes.
The method addEyeTransformNodes() is called and left and right eye nodes are both scaled using the simdScale properties. That's the part I'm confused about.
I tried scaling the same node using .scale and .simdScale properties, but both of them did nothing.
Moreover, what's more confusing is the fact that even though the values for .simdPivot are greater than 1 the node is scaled down. I expected nodes to scale up.
Why would we need to set .simdPivot to scale the nodes but not .scale and .simdScale properties?
Here's the function I'm talking about.
func addEyeTransformNodes() {
guard #available(iOS 12.0, *), let anchorNode = contentNode else { return }
// Scale down the coordinate axis visualizations for eyes.
rightEyeNode.simdPivot = float4x4(diagonal: float4(3, 3, 3, 1))
leftEyeNode.simdPivot = float4x4(diagonal: float4(3, 3, 3, 1))
anchorNode.addChildNode(rightEyeNode)
anchorNode.addChildNode(leftEyeNode)
}
Here's what I tried:
func addEyeTransformNodes() {
guard #available(iOS 12.0, *), let anchorNode = contentNode else { return }
// Does nothing
rightEyeNode.simdScale = float3(3, 3, 3)
// Does nothing
leftEyeNode.scale = SCNVector3(x: 3, y: 3, z: 3)
anchorNode.addChildNode(rightEyeNode)
anchorNode.addChildNode(leftEyeNode)
}
I expected to scale the node with the way I did it, but nothing happened.
Looking forward to your answers and help.