https://github.com/maxxfrazer/rkpointpin
A UIView which points at a RealityKit Entity from screenspace
https://github.com/maxxfrazer/rkpointpin
ar arkit arkit3 augmented augmented-reality ios realitykit swift swiftpm
Last synced: about 1 year ago
JSON representation
A UIView which points at a RealityKit Entity from screenspace
- Host: GitHub
- URL: https://github.com/maxxfrazer/rkpointpin
- Owner: maxxfrazer
- License: mit
- Created: 2020-04-01T20:14:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-29T08:44:39.000Z (about 6 years ago)
- Last Synced: 2024-12-06T21:36:49.832Z (over 1 year ago)
- Topics: ar, arkit, arkit3, augmented, augmented-reality, ios, realitykit, swift, swiftpm
- Language: Swift
- Size: 6.33 MB
- Stars: 48
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RKPointPin
RKPointPin is a UIView which sticks to an `ARView` and points at a chosen entity within the scene, with options to hide the pin when near the center of the screen, or perform any custom actions.
[](https://github.com/apple/swift-package-manager)
[](https://swift.org/)

## Minimum Requirements
- Swift 5.2
- iOS 13.0 (RealityKit)
- Xcode 11.4
### Swift Package Manager
Add the URL of this repository to your Xcode 11+ Project.
`https://github.com/maxxfrazer/RKPointPin.git`
## Usage
See the [Example](./RKPointPin+Example) for a full working example as can be seen in the GIF above
Once you create your `RKPointPin`, add it to your ARView, and then choose your target `Entity`.
Doing so may look similar to this:
```swift
let rkPin = RKPointPin()
self.arView.addSubview(rkPin)
rkPin.targetEntity = boxEntity
```
By default the RKPointPin will be visible all the time, but if you want the pin to hide when in the center, set the `focusPercentage` to a value ranging from 0 to 1. If `focusPercentage` is set to 1, then the pin will only appear when the `targetEntity` is outside of the view, as everything from the edges inwards is considered the focus area.