{"id":25840161,"url":"https://github.com/arirawr/arkit-floorislava","last_synced_at":"2025-03-01T04:40:47.466Z","repository":{"id":85158154,"uuid":"93881475","full_name":"arirawr/ARKit-FloorIsLava","owner":"arirawr","description":"Basic ARKit example that detects planes and makes them lava.","archived":false,"fork":false,"pushed_at":"2018-11-16T05:32:55.000Z","size":4906,"stargazers_count":124,"open_issues_count":1,"forks_count":27,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-21T10:39:28.693Z","etag":null,"topics":["ar","arkit","augmented-reality","ios","ios11","scenekit","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arirawr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-09T17:24:14.000Z","updated_at":"2023-11-30T13:42:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"1207f222-2996-4f6d-a1f0-b76a1acfaf23","html_url":"https://github.com/arirawr/ARKit-FloorIsLava","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirawr%2FARKit-FloorIsLava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirawr%2FARKit-FloorIsLava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirawr%2FARKit-FloorIsLava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirawr%2FARKit-FloorIsLava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arirawr","download_url":"https://codeload.github.com/arirawr/ARKit-FloorIsLava/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241317596,"owners_count":19943201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ar","arkit","augmented-reality","ios","ios11","scenekit","swift"],"created_at":"2025-03-01T04:40:47.044Z","updated_at":"2025-03-01T04:40:47.449Z","avatar_url":"https://github.com/arirawr.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FloorIsLava\nBasic ARKit example that detects planes and makes them lava.\n\n\u003cimg src=\"IMG_0700.PNG\" width=\"200\"\u003e\n\n## Requirements\n- Xcode 9 (you can view the code in Xcode 8 but will not be able to build the project)\n- Device running iOS 11, with an A9 chip or higher (iPhone 6S or newer, iPad Pro)\n\n## Project Walkthrough\n\nWelcome to ARKit! This basic project setup shows how to start an AR session and watch for planes that are detected. We are using an `ARSCNView`, a specially designed SceneKit view that contains an `ARSession`. \n\n### 1. Configuring and starting the session\n\nThe `ARSession` gathers data from the world and processes it. Because we want to place objects on horizontal planes, we need to configure the session to detect them:\n\n```swift\nlet configuration = ARWorldTrackingConfiguration()\nconfiguration.planeDetection = .horizontal\n```\n\nWe can then start the session with this configuration by running:\n\n```swift\nsceneView.session.run(configuration)\n```\n\n### 2. Add a SceneKit node to detected planes\n\nNext, we override the `ARSCNViewDelegate` renderer methods. The SceneView will call these methods when AR \"anchors\" are detected in the world. Since we've configured the session to detect horizontal planes, these methods will be called for those as well.\n\nIn the didAdd method, we check that the discovered node is a plane, then use a helper function to create a simple SceneKit plane. Finally, we add the SceneKit plane as a child of the automatically-generated node for the anchor.\n\n```swift\nfunc renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {\n\n  guard let planeAnchor = anchor as? ARPlaneAnchor else { return }\n  \n  let planeNode = createPlaneNode(anchor: planeAnchor)\n  \n  // ARKit owns the node corresponding to the anchor, so make the plane a child node.\n  node.addChildNode(planeNode) \n}\n```\n\n### 3. Update the SceneKit plane when the AR plane is updated\n\nAs the user moves the device camera around the world, the session gets more information about anchors. We implement the didUpdate method, which is called when the session updates an existing anchor, so we can update our SceneKit node to match the AR plane.\n\n```swift\nfunc renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {\n\n    guard let planeAnchor = anchor as? ARPlaneAnchor else { return }\n\n    // Remove existing plane nodes\n    node.enumerateChildNodes {\n        (childNode, _) in\n        childNode.removeFromParentNode()\n    }\n\n    let planeNode = createPlaneNode(anchor: planeAnchor)\n\n    node.addChildNode(planeNode)\n}\n```\n\n### 4. Remove the SceneKit plane when the AR plane is removed\n\nFinally, we implement the didRemove delegate method to remove any SceneKit planes we've created if a plane is removed from the world.\n\n```swift\nfunc renderer(_ renderer: SCNSceneRenderer, didRemove node: SCNNode, for anchor: ARAnchor) {\n\n    guard anchor is ARPlaneAnchor else { return }\n\n    // Remove existing plane nodes\n    node.enumerateChildNodes {\n        (childNode, _) in\n        childNode.removeFromParentNode()\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirawr%2Farkit-floorislava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farirawr%2Farkit-floorislava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirawr%2Farkit-floorislava/lists"}