scenekit

How to detect penetration without physical interaction in ARKit?

不想你离开。 提交于 2021-02-20 00:59:06
问题 I have a fixed laser beam SCNNode and a detecting sphere SCNNode attached in front of a camera. How to detect penetration without physical interaction? I have not found any clue.. EDIT: - as suggested below by maxxFrazer I implemented physical interaction and I'm able to register collision IF my laser beam is .static and detector moved by camera set .kinematic. 回答1: If you need to detect a penetration without physical interaction use trackedRaycast instance method working in iOS 13+: func

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,

iOS ARKit: Large size object always appears to move with the change in the position of the device camera

雨燕双飞 提交于 2021-02-18 16:44:23
问题 I am creating an iOS ARKit app where I wanted to place a large object in Augmented Reality. When I am trying to place the object at a particular position it always appears to be moving with the change in camera position and I am not able to view the object from all angles by changing the camera position. But if I reduce it's scale value to 0.001 (Reducing the size of the object), I am able to view the object from all angles and the position of the placed object also does not change to that

Setting gravity for SceneKit ParticleEngine particles

我与影子孤独终老i 提交于 2021-02-11 12:47:28
问题 I'm just experimenting with SceneKit as a continuing migration through methods of 3D rendering. I have played with SceneKit and it is generally as advertised. One troublesome aspect (for me) is that while I can create ParticleEngines via the UI or code, I can't figure out how to set the gravitational field for particles created via code. The working code is here: https://github.com/rkwright/ParticleTest. Works with XCode 12.3 and iOS 15.3 Here is the function that sets up the ParticleEngine

Setting gravity for SceneKit ParticleEngine particles

独自空忆成欢 提交于 2021-02-11 12:45:51
问题 I'm just experimenting with SceneKit as a continuing migration through methods of 3D rendering. I have played with SceneKit and it is generally as advertised. One troublesome aspect (for me) is that while I can create ParticleEngines via the UI or code, I can't figure out how to set the gravitational field for particles created via code. The working code is here: https://github.com/rkwright/ParticleTest. Works with XCode 12.3 and iOS 15.3 Here is the function that sets up the ParticleEngine

Xcode 11 Action Editor? How to invoke?

你。 提交于 2021-02-11 04:35:55
问题 In an earlier post I asked about the right settings for initializing a SCNParticleEngine. With some hints from Zay I managed to get both the SCNP and code paths to work – almost identically. Except that the SCNP path had the particles shrinking over time while the coding path did not. Turns out that buried inside the SCNP file is a dictionary entry “Size” which is a SCNParticlePropertyController. Here’s the code from the debugger: The gotcha is that when I open the SCNP file in the editor, I

Xcode 11 Action Editor? How to invoke?

左心房为你撑大大i 提交于 2021-02-11 04:33:29
问题 In an earlier post I asked about the right settings for initializing a SCNParticleEngine. With some hints from Zay I managed to get both the SCNP and code paths to work – almost identically. Except that the SCNP path had the particles shrinking over time while the coding path did not. Turns out that buried inside the SCNP file is a dictionary entry “Size” which is a SCNParticlePropertyController. Here’s the code from the debugger: The gotcha is that when I open the SCNP file in the editor, I

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