Last active
January 5, 2023 16:53
-
-
Save wizard1066/0610c137dd2f4cf300492cadb7a08632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.cubeNode.simdOrientation = faceAnchor!.leftEyeTransform.orientation | |
let newX = (satelliteNode.worldPosition.x * 100).rounded() / 100 | |
let newY = (satelliteNode.worldPosition.y * 100).rounded() / 100 | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .decimal | |
formatter.maximumFractionDigits = 2 | |
let number = NSNumber(value: newX) | |
let formattedValue = formatter.string(from: number)! | |
let number2 = NSNumber(value: newY) | |
let formattedValue2 = formatter.string(from: number2)! | |
looked.gazeX = formattedValue | |
looked.gazeY = formattedValue2 | |
if newX < 0.9 && newY < 0.9 { | |
sphereNode.simdPosition = SIMD3(x: 0, y: 0, z: -6) | |
} | |
if (newX > 0.7 || newX < -0.7) { | |
changeX = newX > 0 ? 2.0 : -2.0 | |
sphereNode.simdPosition = SIMD3(x: changeX, y: 0, z: -6) | |
} | |
if (newY > 0.3 || newY < -0.3) { | |
changeY = newY > 0 ? 1.0 : -1.0 | |
sphereNode.simdPosition = SIMD3(x: 0, y: changeY, z: -6) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment