olexale / arkit_flutter_plugin

ARKit Flutter Plugin
MIT License
796 stars 225 forks source link

Does this plugin support morpher blendshapes? #153

Open PerfectBlueFeynman opened 3 years ago

PerfectBlueFeynman commented 3 years ago

I'm working on a project using flutter and try to achieve a function similar animoji. I have achieved this using native swift with a .dae 3d Model but find it difficult to migrate to dart in flutter. Is the SCNMorpher class migrated or How can SceneKit in iOS work with arkit_plugin in flutter? Thank you!

olexale commented 3 years ago

Hi! SCNMorpher is not available yet but that's a nice feature request!

Will add this as an inspirational note for myself for a sample page:

let baseGeometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0)
baseGeometry.firstMaterial?.diffuse.contents = UIColor.red
let targetGeometry = SCNBox(width: 5, height: 5, length: 5, chamferRadius: 0)

let node = SCNNode(geometry: baseGeometry)

let morpher = SCNMorpher()
morpher.targets = [targetGeometry]

node.morpher = morpher

let animation = CABasicAnimation(keyPath: "morpher.weights[0]")
animation.fromValue = 0.0;
animation.toValue = 1.0;
animation.autoreverses = true;
animation.repeatCount = .infinity;
animation.duration = 5;
node.addAnimation(animation, forKey: nil)

scene.rootNode.addChildNode(node)

If you decide to implement it by yourself - PRs are warmly welcomed!

Best, Oleksandr