let anchor = AnchorEntity(plane: .horizontal, minimumBounds: [0.2, 0.2])
This lane spits errors:
- "Argument passed to call that takes no arguments"
- "Cannot infer contextual base in reference to member 'horizontal'"
However on Apple website I see the option is correct:
init(plane: AnchoringComponent.Target.Alignment, classification: AnchoringComponent.Target.Classification, minimumBounds: SIMD2<Float>)
Why is that? It's a lane from a project I was trying to recreate, but it's about 2years old and abandoned. Has the syntax changed?
Below I paste a bigger chunk of code, maybe it will be useful:
class ViewController: UIViewController {
@IBOutlet var arView: ARView!
override func viewDidLoad() {
super.viewDidLoad()
// ========= THIS LANE CAUSES ERRORS =========
let anchor = AnchorEntity(plane: .horizontal, minimumBounds: [0.2, 0.2])
// ========= THIS LANE CAUSES ERRORS =========
arView.scene.addAnchor(anchor)
var cards: [Entity] = []
for _ in 1...16 {
let box = MeshResource.generateBox(width: 0.04, height: 0.002, depth: 0.04)
let metalMaterial = SimpleMaterial(color: .gray, isMetallic: true)
let model = ModelEntity(mesh: box, materials: [metalMaterial])
model.generateCollisionShapes(recursive: true)
cards.append(model)
}