Skip to content

Instantly share code, notes, and snippets.

@wizard1066
Created October 21, 2022 13:23
Show Gist options
  • Select an option

  • Save wizard1066/09f97a36bbf73554a9026834bd52829e to your computer and use it in GitHub Desktop.

Select an option

Save wizard1066/09f97a36bbf73554a9026834bd52829e to your computer and use it in GitHub Desktop.
while (intersects(point: newPosition, center: result!.position, radius: 0.5)) {
if view.pointOfView!.worldPosition.x > 3.5 {
result!.position.x += 1
}
if view.pointOfView!.worldPosition.x < -3.5 {
result!.position.x -= 1
}
if view.pointOfView!.worldPosition.y > 3.5 {
result!.position.y += 1
}
if view.pointOfView!.worldPosition.y < -3.5 {
result!.position.y -= 1
}
if view.pointOfView!.worldPosition.z > 3.5 {
result!.position.z += 1
}
if view.pointOfView!.worldPosition.z < -3.5 {
result!.position.z -= 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment