In my iOS app I want to introduce a part of AR using the new Reality Composer.
In my project I load a scene with this code:
let arView = ARView.init(fram
In RealityKit framework, use the following type method for generating 3D text:
static func generateText(_ string: String,
extrusionDepth: Float,
font: MeshResource.Font,
containerFrame: CGRect,
alignment: CTTextAlignment,
lineBreakMode: CTLineBreakMode) -> MeshResource
Let's see how a real code looks like:
let textAnchor = try! SomeText.loadTextScene()
let textEntity: Entity = textAnchor.vacation!.children[0].children[0]
var textModelComponent: ModelComponent = (textEntity.components[ModelComponent])!
textModelComponent.mesh = .generateText("Hello, World!",
extrusionDepth: 0.5,
font: .systemFont(ofSize: 0.25),
containerFrame: CGRect.zero,
alignment: .center,
lineBreakMode: .byCharWrapping)
textAnchor.vacation!.children[0].children[0].components.set(textModelComponent)
arView.scene.anchors.append(textAnchor)