This file contains hidden or 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
private func planeBoundary(extent: float3) -> (min: SCNVector3, max: SCNVector3) { | |
let radius = extent * 0.5 | |
return (min: SCNVector3(-radius), max: SCNVector3(radius)) | |
} |
This file contains hidden or 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
func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { | |
guard let plane = anchor as? ARPlaneAnchor, | |
let geometry = node.geometry as? ARSCNPlaneGeometry | |
else { return } | |
geometry.update(from: plane.geometry) | |
node.boundingBox = planeBoundary(extent: plane.extent) | |
} |
This file contains hidden or 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
func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? { | |
guard let plane = anchor as? ARPlaneAnchor, | |
let device = renderer.device, | |
let geometry = ARSCNPlaneGeometry(device: device) | |
else { return nil } | |
geometry.update(from: plane.geometry) | |
let maskMaterial = SCNMaterial() | |
maskMaterial.colorBufferWriteMask = [] | |
geometry.materials = [maskMaterial] | |
let node = SCNNode(geometry: geometry) |
This file contains hidden or 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
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
startTracking() | |
} | |
private func startTracking() { | |
sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints] | |
let configuration = ARWorldTrackingConfiguration() | |
configuration.planeDetection = [.vertical, .horizontal] | |
sceneView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors]) |
This file contains hidden or 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
func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { | |
guard let plane = anchor as? ARPlaneAnchor, | |
let geometry = node.geometry as? ARSCNPlaneGeometry | |
else { return } | |
geometry.update(from: plane.geometry) | |
node.boundingBox = planeBoundary(extent: plane.extent) | |
} |
This file contains hidden or 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
--# Main | |
--Simple Blender .obj loader | |
--assumes each object has only one texture image | |
--currently only supports one object per file | |
--todo: remote images | |
local touches, tArray, lastPinchDist = {}, {} |
This file contains hidden or 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
function setup() | |
local connectionMade = function() | |
output.clear() | |
parameter.clear() | |
print("Connected!") | |
gameSetup() | |
end | |
multihandler = Multiplayer(receiveData, connectionMade) |
This file contains hidden or 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
--# Main | |
-- Markdown Codea | |
-- paragraph-stitching version | |
-- by Yojimbo2000 | |
displayMode(OVERLAY) | |
displayMode(FULLSCREEN) | |
function setup() | |
state = Stitch | |
state.init() |
This file contains hidden or 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
--# Main | |
-- Markdown Codea | |
-- by Yojimbo2000 | |
displayMode(FULLSCREEN) | |
function setup() | |
setText() | |
y,vel = 0,0 | |
scrollY={} --store deltas for smooth scrolling upon finger release | |
end |
This file contains hidden or 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
--# Main | |
-- Json Test | |
supportedOrientations(LANDSCAPE_LEFT) | |
displayMode(OVERLAY) | |
-- Use this function to perform your initial setup | |
function setup() | |
parameter.action("Take snapshot", function() tabSave(objects, "Test") end) | |
parameter.action("Load from snapshot", function() killBodies() loadBodies() end) | |
AddToJson() --establish metamethods for encoding vec2, vec3, vec4, matrix as json objects |
NewerOlder