Created
August 26, 2017 14:20
-
-
Save ChrisFlannagan/a27c23a9aa73e0975eb12e67bd261d07 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
// | |
// Rope.swift | |
// BiminiRingToss | |
// | |
// Created by Christopher Flannagan on 8/19/17. | |
// Copyright © 2017 Christopher Flannagan. All rights reserved. | |
// | |
import Foundation | |
import SceneKit | |
class Rope { | |
var holder: SCNNode | |
var rope: SCNNode | |
func getHolder() -> SCNNode { | |
return holder | |
} | |
func getRope() -> SCNNode { | |
return rope | |
} | |
init() { | |
holder = SCNNode() | |
var geometry:SCNGeometry | |
geometry = SCNSphere(radius: 0.1) | |
geometry.materials.first?.diffuse.contents = UIColor.blue | |
rope = SCNNode(geometry: geometry) | |
rope.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil) | |
rope.physicsBody?.mass = 5.0 | |
} | |
func getLink( y:Float ) -> SCNNode { | |
var geometry:SCNGeometry | |
var link:SCNNode | |
geometry = SCNSphere(radius: 0.1) | |
geometry.materials.first?.diffuse.contents = UIColor.green | |
link = SCNNode(geometry: geometry) | |
link.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil) | |
link.physicsBody?.mass = 3.0 | |
return link | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment