Skip to content

Commit

Permalink
feat: the first version of AR Glowby
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-i committed Feb 3, 2024
1 parent 92e1304 commit bd8c4b1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/ios/Runner/Glowby.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@ import UIKit
import RealityKit

class GlowbyARView: UIView {

var arView: ARView!

override init(frame: CGRect) {
super.init(frame: frame)
arView = ARView(frame: CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.height))
arView = ARView(frame: .zero) // Initialize with zero frame
arView.autoresizingMask = [.flexibleWidth, .flexibleHeight] // Use autoresizing instead
self.addSubview(arView)
// Setup the rest of your AR scene here.

// Setup RealityKit scene here
let anchor = AnchorEntity(world: .zero) // Corrected to use the right initializer
let mesh = MeshResource.generateBox(size: 0.1) // Creates a cube of 10cm x 10cm x 10cm
let material = SimpleMaterial(color: .blue, isMetallic: true)
let cube = ModelEntity(mesh: mesh, materials: [material])
anchor.addChild(cube)

arView.scene.anchors.append(anchor)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

0 comments on commit bd8c4b1

Please sign in to comment.