Skip to content

Commit

Permalink
Merge pull request #1 from maxxfrazer/hide-no-scene
Browse files Browse the repository at this point in the history
- Hide pin when entity is not in a scene
  • Loading branch information
maxxfrazer committed Apr 29, 2020
2 parents 44854c3 + 43ec2e2 commit 1f21466
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/RKPointPin/RKPointPin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,16 @@ public class RKPointPin: UIView {
guard let ent = self.targetEntity,
ent.scene != nil,
let projPoint = arView.project(ent.position(relativeTo: nil)) else {
if self.pinBody.isHidden {
// hide because we do not want to show it now
if !self.pinBody.isHidden {
// hide pin if it is showing
self.pinBody.isHidden = true
}
return
}
if self.pinBody.isHidden {
// show pin if it is hidden
self.pinBody.isHidden = false
}
let matrixZAxis = arView.cameraTransform.matrix.columns.2
let zFacing: SIMD3<Float> = [matrixZAxis.x, matrixZAxis.y, matrixZAxis.z]
let toEntityDirection = ent.position(relativeTo: nil) - arView.cameraTransform.translation
Expand Down

0 comments on commit 1f21466

Please sign in to comment.