Initial Commit

This commit is contained in:
Dennis Nemec
2026-08-19 16:14:26 +02:00
commit 3d9f1ab6bc
13 changed files with 934 additions and 0 deletions

View File

@ -0,0 +1,40 @@
//
// ContentView.swift
// GasTankAR
//
// Created by Dennis Nemec on 19.08.26.
//
import SwiftUI
import RealityKit
struct ContentView : View {
var body: some View {
RealityView { content in
// Create a cube model
let model = Entity()
let mesh = MeshResource.generateBox(size: 0.1, cornerRadius: 0.005)
let material = SimpleMaterial(color: .gray, roughness: 0.15, isMetallic: true)
model.components.set(ModelComponent(mesh: mesh, materials: [material]))
model.position = [0, 0.05, 0]
// Create horizontal plane anchor for the content
let anchor = AnchorEntity(.plane(.horizontal, classification: .any, minimumBounds: SIMD2<Float>(0.2, 0.2)))
anchor.addChild(model)
// Add the horizontal plane anchor to the scene
content.add(anchor)
content.camera = .spatialTracking
}
.edgesIgnoringSafeArea(.all)
}
}
#Preview {
ContentView()
}