Skip to content

Instantly share code, notes, and snippets.

@tkmn0
Created May 24, 2017 15:57
Show Gist options
  • Save tkmn0/b4e93ec238b0d2945e8756a6eae712b1 to your computer and use it in GitHub Desktop.
Save tkmn0/b4e93ec238b0d2945e8756a6eae712b1 to your computer and use it in GitHub Desktop.
simple manipulator for scenekit (just vector)
func createVectorNode() -> SCNNode{
let vectorX: SCNGeometry = SCNBox(width: 1, height: 0.02, length: 0.02, chamferRadius: 10)
vectorX.materials.first?.diffuse.contents = UIColor.red
let vectorXNode: SCNNode = SCNNode(geometry: vectorX)
vectorXNode.position = SCNVector3(x: 0.5, y: 0, z: 0)
let vectorY: SCNGeometry = SCNBox(width: 0.02, height: 1, length: 0.02, chamferRadius: 10)
vectorY.materials.first?.diffuse.contents = UIColor.green
let vectorYNode: SCNNode = SCNNode(geometry: vectorY)
vectorYNode.position = SCNVector3(x: 0, y: 0.5, z: 0)
let vectorZ: SCNGeometry = SCNBox(width: 0.02, height: 0.02, length: 1, chamferRadius: 10)
vectorZ.materials.first?.diffuse.contents = UIColor.blue
let vectorZNode: SCNNode = SCNNode(geometry: vectorZ)
vectorZNode.position = SCNVector3(x: 0, y: 0, z: 0.5)
let vectorNode: SCNNode = SCNNode()
vectorNode.addChildNode(vectorXNode)
vectorNode.addChildNode(vectorYNode)
vectorNode.addChildNode(vectorZNode)
vectorNode.position = SCNVector3(x: 0, y: 0, z: -3)
return vectorNode
}
@tkmn0
Copy link
Author

tkmn0 commented May 24, 2017

language swift3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment