scnnode

SceneKit draw curved line

可紊 提交于 2021-02-19 04:32:35
问题 I'd like to draw a bezier curved line with SceneKit and thought this would work: func drawCurvedLine() { let scene = SCNScene() let scnView = self.view as! SCNView scnView.scene = scene scnView.allowsCameraControl = true let path = UIBezierPath() path.moveToPoint(CGPoint(x: -20, y: -20)) path.addCurveToPoint(CGPoint(x: 20, y: 20), controlPoint1: CGPoint(x: 5, y: 5), controlPoint2: CGPoint(x: 15, y: 15)) path.closePath() path.flatness = 0.3 var scnShape:SCNShape = SCNShape(path: path,

SceneKit draw curved line

巧了我就是萌 提交于 2021-02-19 04:31:30
问题 I'd like to draw a bezier curved line with SceneKit and thought this would work: func drawCurvedLine() { let scene = SCNScene() let scnView = self.view as! SCNView scnView.scene = scene scnView.allowsCameraControl = true let path = UIBezierPath() path.moveToPoint(CGPoint(x: -20, y: -20)) path.addCurveToPoint(CGPoint(x: 20, y: 20), controlPoint1: CGPoint(x: 5, y: 5), controlPoint2: CGPoint(x: 15, y: 15)) path.closePath() path.flatness = 0.3 var scnShape:SCNShape = SCNShape(path: path,

SceneKit - adding SCNNode on another SCNNode

故事扮演 提交于 2021-02-08 07:20:56
问题 I'm trying to put sphere on top of the box, but the position is strange: Ball is half hidden inside box. I tried to change box and sphere pivot, but it didn't help. Here's the code: let cubeGeometry = SCNBox(width: 10, height: 10, length: 10, chamferRadius: 0) let cubeNode = SCNNode(geometry: cubeGeometry) //cubeNode.pivot = SCNMatrix4MakeTranslation(0, 1, 0) scene.rootNode.addChildNode(cubeNode) let ballGeometry = SCNSphere(radius: 1) let ballNode = SCNNode(geometry: ballGeometry) ballNode

SceneKit - adding SCNNode on another SCNNode

送分小仙女□ 提交于 2021-02-08 07:20:02
问题 I'm trying to put sphere on top of the box, but the position is strange: Ball is half hidden inside box. I tried to change box and sphere pivot, but it didn't help. Here's the code: let cubeGeometry = SCNBox(width: 10, height: 10, length: 10, chamferRadius: 0) let cubeNode = SCNNode(geometry: cubeGeometry) //cubeNode.pivot = SCNMatrix4MakeTranslation(0, 1, 0) scene.rootNode.addChildNode(cubeNode) let ballGeometry = SCNSphere(radius: 1) let ballNode = SCNNode(geometry: ballGeometry) ballNode

Check if SCNNode SCNAction is finished

爷,独闯天下 提交于 2021-02-07 03:15:05
问题 I have created a SceneKit 3D maze world in which a player can move. Some of the moves like jumping involve moving the camera up and down while changing to view direction over a period of time of several seconds. During this time I would like to ignore taps and swipes by the user that would normally result in other types of movements like turning and moving forward. I could create a timer that matches the jump duration and sets a Bool but I was hoping for a simplier way of checking the SCNNode

Check if SCNNode SCNAction is finished

南笙酒味 提交于 2021-02-07 03:13:15
问题 I have created a SceneKit 3D maze world in which a player can move. Some of the moves like jumping involve moving the camera up and down while changing to view direction over a period of time of several seconds. During this time I would like to ignore taps and swipes by the user that would normally result in other types of movements like turning and moving forward. I could create a timer that matches the jump duration and sets a Bool but I was hoping for a simplier way of checking the SCNNode

Is there a way to draw a SCNNode always in front of others?

会有一股神秘感。 提交于 2021-02-07 02:48:52
问题 I've been trying to make a scene with scene kit in which an specified object is always in front of others, despite the fact that it's actually behind the other objects. A similar effect to this used in blender. Apparently, blender uses GUI and a lot of math to transform otherwise 2D objects, but I need this effect in a SCNNode with a SCNGeometry, in other words, a 3D object currently locate in the scene. I considered using category masks, but after reading Apple's documentation I've realized

Is there a way to draw a SCNNode always in front of others?

天涯浪子 提交于 2021-02-07 02:48:30
问题 I've been trying to make a scene with scene kit in which an specified object is always in front of others, despite the fact that it's actually behind the other objects. A similar effect to this used in blender. Apparently, blender uses GUI and a lot of math to transform otherwise 2D objects, but I need this effect in a SCNNode with a SCNGeometry, in other words, a 3D object currently locate in the scene. I considered using category masks, but after reading Apple's documentation I've realized

ARKit - How to load .scn and texture file from server URL

橙三吉。 提交于 2021-02-06 09:19:04
问题 I try to load dynamically .scn and texture files from server URL in ARKit application. I have achieved loading .scn file from web url this way.. But after running I am not seeing any textures on device. I get following error message. ARKitExample[3016:995067] [SceneKit] Error: Failed loading : <C3DImage 0x1d42e1980 src:file:///var/containers/Bundle/Application/622ACF79-2318-4953-A9AE-9A7F2B453AFB/ARKitExample.app/textures/lamp_DIFFUSE.png [0.000000x0.000000]> ARKitExample[3016:995067]

How to draw dashed line in ARKit (SceneKit) like in the Measure app?

旧时模样 提交于 2021-02-05 05:07:39
问题 Just wanted to know is it possible (I know it is, but how) to draw dashed line in ARSCNView like in the Measure app? Maybe there is a way to use scene nodes out of the box, idk. I've been using the SCNCylinder to draw a straight line and IDK is it possible to reuse it and adjust or we have to use a really different way to make the dashed line. import SceneKit class CylinderLineNode: SCNNode { private(set) var cylinder: SCNCylinder private(set) var positionA: SCNVector3 private(set) var