Swiftpack.co -  Package - Reality-Dev/RealityKit-Path-Maker
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Reality-Dev/RealityKit-Path-Maker
Create paths for your apps using just an array of points.
.package(url: "https://github.com/Reality-Dev/RealityKit-Path-Maker.git", from: "1.0.1")

RKPath

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,

  1. Initialize a new path entity like this:
     var pathEntity = RKPathEntity(path: [])

or like this:

     var pathEntity = RKPathEntity(path: [],
                                 width: 0.35,
                                 materials: [UnlitMaterial.init(color: .blue)])
  1. Add your path entity to an anchor that is anchored in the scene like this;
        let worldAnchor = AnchorEntity() //point 0,0,0
        self.scene.addAnchor(worldAnchor)
        worldAnchor.addChild(pathEntity)
  1. Add points to your path and it will automatically update:
        let myNewPoint = SIMD3<Float>()
        self.pathEntity.pathPoints.append(myNewPoint)

GitHub

link
Stars: 1
Last commit: 4 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco