This package makes it easy to generate paths in RealityKit.
There is an example project included in this repo to show you how to use it.
After you add the swift package and import RKPath,
- Initialize a new path entity like this:
var pathEntity = RKPathEntity(arView: arView)or like this:
var pathEntity = RKPathEntity(arView: arView,
path: [],
width: 0.35,
materials: [UnlitMaterial.init(color: .blue)])Your entity will automatically add itself to the scene.
- Add points to your path (or change the pathPoints array however you want) and it will automatically update:
let myNewPoint = SIMD3<Float>()
self.pathEntity.pathPoints.append(myNewPoint)