Home > database >  RealityKit's equivalent of SceneKit's SCNShape
RealityKit's equivalent of SceneKit's SCNShape

Time:03-18

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

CodePudding user response:

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])
  • Related