Skip to content

Instantly share code, notes, and snippets.

View nmathew87's full-sized avatar

Neil Mathew nmathew87

View GitHub Profile
@nmathew87
nmathew87 / ReticleController.cs
Created February 13, 2020 18:50
Updated reticle controller for HelloWorld sample in PlacenoteSDK-Unity. This controller makes the ARKit FeaturePoint HitTest much smoother and more robust than the default version.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
namespace HelloWorld
{
// Add this to the top of your file
import PlacenoteSDK
// Initialize LibPlacenote in your application launch function like this
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
LibPlacenote.instance.initialize(apiKey: "Enter API Key Here")
return true
}
override func viewDidLoad() {
super.viewDidLoad()
// configuration
LibPlacenote.instance.multiDelegate += self
// set up AR session
self.sceneView.session.run(configuration)
self.sceneView.autoenablesDefaultLighting = true
self.sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
@nmathew87
nmathew87 / rendersphere.swift
Last active March 14, 2018 23:19
Render sphere function
func renderSphere() {
let geometry:SCNGeometry = SCNSphere(radius: 0.05) //units, meters
let geometryNode = SCNNode(geometry: geometry)
geometryNode.position = SCNVector3(x:0.0, y:0.0, z:0.0)
geometryNode.geometry?.firstMaterial?.diffuse.contents = UIColor.green
sceneView.scene.rootNode.addChildNode(geometryNode)
}