I want to move an Entity in from the right programmatically, but the move function is not working. I am using image tracking. I can place the entity statically, so I know I'm detecting the image. Here is my function.
func placeMyPictureEntity(imageAnchor: ARImageAnchor) {
if let entity = try? Experience.loadMyScene() {
entity.scale = SIMD3(0, 0, 0)
let imageAnchorEntity = AnchorEntity(anchor: imageAnchor)
imageAnchorEntity.name = imageAnchor.name!
// Position the entity to the side
let anchorWidth = Float(imageAnchor.referenceImage.physicalSize.width)
entity.setPosition(SIMD3<Float>(x: 20.0*anchorWidth , y: 0.0, z: 0.0), relativeTo: imageAnchorEntity)
let newTransform = Transform(scale: SIMD3(20.0, 20.0, 20.0), rotation: simd_quaternion(0, 0, 0, 1), translation: SIMD3(x: anchorWidth, y: 0.0, z: 0.0))
entity.move(to: newTransform, relativeTo: imageAnchorEntity, duration: 2.0, timingFunction: .easeIn)
imageAnchorEntity.addChild(entity)
// Add anchor to scene
arView.scene.addAnchor(imageAnchorEntity)
}
}
Any help would be most appreciated. Thanks.