Post

Replies

Boosts

Views

Activity

Rounded button in realitykit using swiftui
I'm developing an ar app using reality kit and Arkit and i want to have my buttons in the same theme of vision os buttons thin , transparent background and round at corners.Following is the code i have written and need help with it func createButton(label: String, position: SIMD3<Float>) -> ModelEntity { let button = ModelEntity(mesh: .generateBox(size: [0.3, 0.1, 0.02], cornerRadius: 10), materials: [SimpleMaterial(color: .blue, isMetallic: false)]) button.generateCollisionShapes(recursive: true) button.position = position // Add button label let buttonText = ModelEntity(mesh: .generateText(label, extrusionDepth: 0.005, font: .systemFont(ofSize: 0.05))) buttonText.model?.materials = [SimpleMaterial(color: .white, isMetallic: true)] buttonText.position = [-0.07, -0.02, 0.01] button.addChild(buttonText) return button }
1
0
89
1d