scnnode

SCNLevelOfDetails delegate/notification

吃可爱长大的小学妹 提交于 2020-01-16 14:35:27
问题 I'm using SCNLevelOfDetails with SceneKit. I was wondering if there's a way to know when the engine changes the levelOfDetails for a particular node's geometry. Many thanks. 回答1: I'm answering my own question. To give more context, we needed to know when the LOD would change in order to stop an idle animation, our model is skinned. What happens if you don't disable this animation when the LOD changes is that the geo goes all over the place and it looks wrong. The solution for us was to clone

SceneKit: advice on reproducing glowing light trail like with Tron light cycles

China☆狼群 提交于 2020-01-13 22:42:09
问题 The goal is to reproduce a light trail similar to the image below in SceneKit. The trail doesn't need to be as detailed, but the idea is to achieve a similar visual effect. We tried using thin cubes with opacity around 0.5. We strung about 200 together and attached them to a node to act as a light trail. That was not performant at all. This other post suggests using particle emitters, but we also need to detect collisions when another object hits the trail. Class documentation says collision

SceneKit: advice on reproducing glowing light trail like with Tron light cycles

不想你离开。 提交于 2020-01-13 22:41:31
问题 The goal is to reproduce a light trail similar to the image below in SceneKit. The trail doesn't need to be as detailed, but the idea is to achieve a similar visual effect. We tried using thin cubes with opacity around 0.5. We strung about 200 together and attached them to a node to act as a light trail. That was not performant at all. This other post suggests using particle emitters, but we also need to detect collisions when another object hits the trail. Class documentation says collision

Using SceneKit for hitTesting not returning a hit with SCNNode

自作多情 提交于 2020-01-05 02:30:36
问题 The documentation in XCode clearly states that hitTesting a geometry in SceneKit can be done with SCNRender, SCNView or the SCNNode themselves when one plans to test a 3D line segment. I have a use for SCNScene with its nodes without a renderer or a view, therefore I am planning to use SCNNode hitTesting. I create a SCNScene, put a SCNNode in it and test a simple ray that goes through, but I always get an empty hitList and I don't understand why: import Swift import SceneKit let boxGeometry =

How to create an array of SCNNode in swift

ぐ巨炮叔叔 提交于 2019-12-25 06:59:19
问题 I want to create a fund to create an array of nodes. My declaration is as follows: func createSphereNode () { var spheres = [SCNNode()] let sphereGeometry = SCNSphere(radius: 2.5) let sphereMaterial = SCNMaterial() sphereMaterial.diffuse.contents = UIColor.greenColor() sphereGeometry.materials = [sphereMaterial] for var i=0;i<15;i++ { let gravityFields = SCNPhysicsField.radialGravityField() gravityFields .strength = 0 spheres[i] = SCNNode(geometry: sphereGeometry) spheres[i].position =

How to remove SCNNode when Tap on it?

ぐ巨炮叔叔 提交于 2019-12-24 10:55:25
问题 I have Creat Cubes using SceneView and i want to disappear cube on which Tap action. How can achieve it? Here is my code to create Cube SCNBox *Box = [SCNBox boxWithWidth:2.0 height:2.0 length:2.0 chamferRadius:Radius]; Box.firstMaterial.diffuse.contents = [UIColor whiteColor]; SCNNode *cubeNode = [SCNNode nodeWithGeometry:Box]; [ArrBoxNode addObject:cubeNode]; self.sceneView.backgroundColor = [UIColor redColor]; self.view.backgroundColor = [UIColor grayColor]; cubeNode.position =

Why does SCNNode .flattenedClone() either crash or make performance worse?

你离开我真会死。 提交于 2019-12-24 07:39:06
问题 I'm attempting to add around 4.5k SCNNode objects to a scene. Their geometries are one of two SCNPlane s, whose materials are rendered by CALayer s (but I don't think that matters, the CALayerDelegate s are only called once each, so that doesn't seem to be an issue.) Performance is terrible (< 1fps.) With .showsStatistics enabled I see I'm doing almost 3.5k draw calls, which is my problem according to this WWDC video from 2017. So, as suggested, I add all my nodes to one parent node and call

SceneKit: cannot add SCNReferenceNode programmatically though works in Xcode Scene Editor

别来无恙 提交于 2019-12-23 03:02:23
问题 Adding a SCNReferenceNode works when done from the Xcode Scene Editor. When done programmatically with the code below, however, nothing appears in the scene. filePath contains a valid path as proven by the print statement as well as stepping through the code. Help? if let filePath = NSBundle.mainBundle().pathForResource("RefTest", ofType: "scn", inDirectory: "TestScene.scnassets") { let referenceURL = NSURL(fileURLWithPath: filePath) if #available(iOS 9.0, *) { let referenceNode =

How to change SCNPlane color as clear color

ε祈祈猫儿з 提交于 2019-12-22 08:12:51
问题 I am working on a ARKit project which needs Ripple animation effect when tapped on Horizontal Plane. For that I have took UIView object and pass that as contents for material of SCNPlane object. I have added Ripple animation to UIView object. Everything works fine. But I can't change the SCNPlane colour to clear color. I can use transparency property for the material. But it is hiding Ripple animation too. So, what I need here is, the background colour of SCNPlane object should be transparent

ARKit - How to contain SCNText within another SCNNode (speech bubble)

落花浮王杯 提交于 2019-12-21 06:23:09
问题 I am trying to create a quote generator with simple text within a speech bubble in ARKit. I can show the speech bubble with text, but the text always starts in the middle and overflows outside of the speech bubble. Any help getting it align in the top left of the speech bubble and wrapping within the speech bubble would be appreciated. Result Classes class SpeechBubbleNode: SCNNode { private let textNode = TextNode() var string: String? { didSet { textNode.string = string } } override init()