I want to fade objects in and out, and while setting an entity's OpacityComponent works, animating it doesn't seem to do anything.
In the following code the second sphere should fade out, but it keeps its initial opacity. On the other hand, the animation that changes its transform works. What am I doing wrong?
class ViewController: NSViewController {
override func loadView() {
let arView = ARView(frame: NSScreen.main!.frame)
let anchor = AnchorEntity(.world(transform: matrix_identity_float4x4))
arView.scene.addAnchor(anchor)
let sphere = ModelEntity(mesh: .generateSphere(radius: 0.5))
anchor.addChild(sphere)
sphere.components.set(OpacityComponent(opacity: 0.1))
let sphere2 = ModelEntity(mesh: .generateSphere(radius: 0.5))
sphere2.position = .init(x: 0.2, y: 0, z: 0)
anchor.addChild(sphere2)
sphere2.components.set(OpacityComponent(opacity: 0.1))
sphere.playAnimation(try! AnimationResource.makeActionAnimation(for: FromToByAction(to: 0, timing: .linear), duration: 1, bindTarget: .opacity))
sphere.playAnimation(try! AnimationResource.makeActionAnimation(for: FromToByAction(to: Transform(translation: SIMD3(x: 0.1, y: 0, z: 0)), timing: .linear), duration: 1, bindTarget: .transform))
view = arView
}
}