I am developing a SwiftUI app and want to use Ready Player Me avatar cause they can with premade blend shapes. Although the blend shapes are visible in the Xcode SceneKit editor and function correctly when I manually manipulated them as in the image, I cannot access them at runtime through SwiftUI.
I am unable to find the SCNMorpher
on the Wolf3D_Head
node during runtime, despite the node being present with blend shapes in the SceneKit editor. This issue persists when I use both .usdz
and .dae
file formats for the avatar. The debug output consistently reads “Wolf3D_Head node not found in the scene,”
Code Used for Accessing the Morpher:
‘’‘’
func updateUIView(_ uiView: SCNView, context: Context) {
DispatchQueue.main.async {
if let headNode = uiView.scene?.rootNode.childNode(withName: “Wolf3D_Head”, recursively: true),
let morpher = headNode.morpher {
morpher.setWeight(CGFloat(volumeLevel), forTargetNamed: “mouthOpen”)
} else {
print(“Wolf3D_Head node not found in the scene”)
}
}
}
‘’‘’’
Are there known issues with accessing SCNMorpher
and blend shapes on Ready Player Me avatars in SwiftUI’s SCNView
? or am I just doing something wrong?