scnnode

SCNGeometry with polygon as primitiveType

会有一股神秘感。 提交于 2019-11-29 07:44:53
Trying to figure out how I create a SCNGeometry with polygon as primitiveType, My goal is to add polygon shaped node as a child of a sphere node, and make it look like MKPolygon for map kit, like in this example . My current code is: //Take an arbitrary array of vectors let vertices: [SCNVector3] = [ SCNVector3Make(-0.1304485, 0.551937, 0.8236193), SCNVector3Make(0.01393811, 0.601815, 0.7985139), SCNVector3Make(0.2971005, 0.5591929, 0.7739732), SCNVector3Make(0.4516893, 0.5150381, 0.7285002), SCNVector3Make(0.4629132, 0.4383712, 0.7704169), SCNVector3Make(0.1333823, 0.5224985, 0.8421428),

Xcode 7 SceneKit object's position property does not update when moved?

血红的双手。 提交于 2019-11-28 11:50:44
问题 So I'm making a game and in said game, you will use a DPad to move your ball around the scene. I'm using Xcode 7 Beta 5 though the same problem existed in beta 4. Here is the code of a test view controller: class TestController: UIViewController,DPadDelegate { @IBOutlet var scnView:SCNView! @IBOutlet var dpad:DPad! var timer:NSTimer? var update:NSTimer? var colors = [UIColor.blueColor(),UIColor.redColor(),UIColor.whiteColor(),UIColor.yellowColor(),UIColor.cyanColor(),UIColor.orangeColor()

SCNBox different colour or texture on each face

你离开我真会死。 提交于 2019-11-28 04:44:33
I'm new to iOS development and I've got myself stumped. I am trying to render a cube using SceneKit that has a different colour for each face. This is what I've got so far: func sceneSetup() { // 1 let scene = SCNScene() // 2 let BoxGeometry = SCNBox(width: 0.9, height: 0.9, length: 0.9, chamferRadius: 0.0) BoxGeometry.firstMaterial?.diffuse.contents = UIColor.redColor() let cube = SCNNode(geometry: BoxGeometry) cube.position = SCNVector3(x: 0, y: 0, z: -1) scene.rootNode.addChildNode(cube) // 3 sceneView.scene = scene sceneView.autoenablesDefaultLighting = true sceneView.allowsCameraControl =

SCNGeometry with polygon as primitiveType

只愿长相守 提交于 2019-11-28 01:24:42
问题 Trying to figure out how I create a SCNGeometry with polygon as primitiveType, My goal is to add polygon shaped node as a child of a sphere node, and make it look like MKPolygon for map kit, like in this example. My current code is: //Take an arbitrary array of vectors let vertices: [SCNVector3] = [ SCNVector3Make(-0.1304485, 0.551937, 0.8236193), SCNVector3Make(0.01393811, 0.601815, 0.7985139), SCNVector3Make(0.2971005, 0.5591929, 0.7739732), SCNVector3Make(0.4516893, 0.5150381, 0.7285002),

Stroke Width with a SceneKit line primitive type

蓝咒 提交于 2019-11-27 20:17:02
I am trying to replicate this cube image shape (with permission from the original creator ) using scene kit. Thus far, I have the drawing code for the lines and the vertices. I cannot use an image because the background has to be transparent. The specific I am trying to solve right now is how to edit the stroke width for the SCNGeometryPrimitiveType.Line element. The basic way I am creating lines is like this: private func squareVertices(length: Float) -> [SCNVector3] { let m = length/Float(2) let topLeft = SCNVector3Make(-m-q, m+q, m+q) let topRight = SCNVector3Make( m+q, m+q, m+q) let

cameranode rotate as iOS device moving

廉价感情. 提交于 2019-11-27 20:14:28
It's 360 degree video player project. I add a cameranode( SCNNode ) to a rootnode, the cameranode was put at the center(0,0,0) of the SCNSphere , It can play video by now. Now I have to use devicemotion. I need to rotate the camera when device moves. Not just rotate a certain angle. (Not just device move, When I'm holding a device, my moving regard as the device moving. because I found if I use deviceMotion.attitude.roll , the cameranode only moves when device moves by itself, not when I circle around with device) When device is located in (x1,y1,z1) position, the cameranode would rotate as

Placing, Dragging and Removing SCNNodes in ARKit

泪湿孤枕 提交于 2019-11-27 14:12:47
问题 I'm working on a small project using ARKit. I want to be able to add objects to my AR SceneView on tap, remove them with a double tap, and drag theme around with a pan or drag. The initial tap to place objects is working fine, but I have some issues with the Node removal and the dragging. The main issue with the removal and the dragging is that it is very difficult to actually 'hold' or click on the SCNNode. Most of the results end up not being on the SCNNode I've added. The second issue is

cameranode rotate as iOS device moving

半腔热情 提交于 2019-11-26 20:18:03
问题 It's 360 degree video player project. I add a cameranode( SCNNode ) to a rootnode, the cameranode was put at the center(0,0,0) of the SCNSphere , It can play video by now. Now I have to use devicemotion. I need to rotate the camera when device moves. Not just rotate a certain angle. (Not just device move, When I'm holding a device, my moving regard as the device moving. because I found if I use deviceMotion.attitude.roll , the cameranode only moves when device moves by itself, not when I

Stroke Width with a SceneKit line primitive type

一个人想着一个人 提交于 2019-11-26 20:15:45
问题 I am trying to replicate this cube image shape (with permission from the original creator) using scene kit. Thus far, I have the drawing code for the lines and the vertices. I cannot use an image because the background has to be transparent. The specific I am trying to solve right now is how to edit the stroke width for the SCNGeometryPrimitiveType.Line element. The basic way I am creating lines is like this: private func squareVertices(length: Float) -> [SCNVector3] { let m = length/Float(2)