Created
May 24, 2017 15:57
-
-
Save tkmn0/b4e93ec238b0d2945e8756a6eae712b1 to your computer and use it in GitHub Desktop.
simple manipulator for scenekit (just vector)
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 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
language swift3.0