'RealityKit's equivalent of SceneKit's SCNShape

On SceneKit, using SCNShape we can create SCN geometry from SwiftUI 2D shapes/beziers: https://developer.apple.com/documentation/scenekit/scnshape

Is there an equivalent in RealityKit? Could we use the generate(from:) for that? https://developer.apple.com/documentation/realitykit/meshresource/3768520-generate



Solution 1:[1]

In RealityKit 2.0 you can generate a mesh using MeshDescriptor. There is no support for two-dimensional path at the moment, like it's implemented in SceneKit.

var descriptor = MeshDescriptor(name: "anything")
descriptor.primitives = .triangles(indices)
let mesh: MeshResource = try! .generate(from: [descriptor])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andy Jazz