scnnode

Drag SceneKit Node Along X-Axis while maintaining velocity? Swift 3

佐手、 提交于 2019-12-07 20:50:47
问题 Swift 3, SceneKit: In my game, I have an SCNSphere node in the center of the screen. The sphere drops by gravity onto an SCNBox node, and a velocity of SCNVector3(0,6,0) is applied to it once it collides with the box. A new box is created and moves forward (z+) towards my camera and towards the sphere as well. The sphere rises, peaks, and then falls back down (by gravity) towards the new box, and when it collides with the new box, a velocity of SCNVector(0,6,0) is applied to it. This process

SCNNode and Firebase

女生的网名这么多〃 提交于 2019-12-07 19:56:03
问题 I have 15 box and I add an image on each boxnode as first material. How can I load the images from Firebase and add an Image to each node. I already know how to load images from Firebase, I want to know the best way I can add an image on each 15 nodes, Thanks. Here's the view controller: class newsVC: UIViewController, presentVCProtocol { @IBOutlet var scnView: SCNView! var newsScene = NewsScene(create: true) var screenSize: CGRect! var screenWidth: CGFloat! var screenHeight: CGFloat! var

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

北战南征 提交于 2019-12-06 13:44:57
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 detection with particle emitters is also not performant. Any suggestions on the best way to do simulate

Drag SceneKit Node Along X-Axis while maintaining velocity? Swift 3

╄→гoц情女王★ 提交于 2019-12-06 11:27:35
Swift 3, SceneKit: In my game, I have an SCNSphere node in the center of the screen. The sphere drops by gravity onto an SCNBox node, and a velocity of SCNVector3(0,6,0) is applied to it once it collides with the box. A new box is created and moves forward (z+) towards my camera and towards the sphere as well. The sphere rises, peaks, and then falls back down (by gravity) towards the new box, and when it collides with the new box, a velocity of SCNVector(0,6,0) is applied to it. This process repeats continuously. A sphere that repeatedly bounces on a new approaching box, basically. Instead of

SceneKit: use transform or directly manipulate rotation/position properties if goal is to rotate camera and project node X units in front of camera?

大憨熊 提交于 2019-12-06 05:29:28
For a voxel art app, the goal is to let users move and rotate a camera in a SceneKit scene then tap to place a block. The code below lets a user rotate a camera by panning. After the gesture ends, we move an existing block so it is -X units on the camera's Z-axis (i.e., -X units in front of the camera). cameraNode is the scene's point of view and is a child of userNode . When the user moves a joystick, we update the position of userNode. Question: Other SO posts manipulate camera nodes by applying a transform instead of changing the rotation and position properties. Is one approach better than

SceneKit, 'hit' testing between camera orientation and geometry

我们两清 提交于 2019-12-05 21:45:18
I'm currently following David Roonqvist's 3D Graphics with SceneKit book. Chapter 5 deals with hit testing, no issues implementing it, but only deals with his testing from mouse events. Now, I know my camera's orientation will ALWAYS intersect a certain geometry. I need to obtain the texture coordinate of the intersecting point between the camera orientation and the geometry. Any pointers as how to go about it? I've been looking all over without much success. Any help is appreciated. I haven't tried this but... SCNHitTestResult returns, among other things, textureCoordinatesWithMappingChannel(

How to change SCNPlane color as clear color

China☆狼群 提交于 2019-12-05 17:12:47
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 and only Ripple animation should appear to user. Can someone help me on this. This is my code. let

Why is SCNNode “jiggling” when dropped onto SCNPlane?

半城伤御伤魂 提交于 2019-12-05 14:49:31
I have a SCNPlane that is added to the scene when a sufficient area is detected for a horizontal surface. The plane appears to be placed in a correct spot, according to the floor/table it's being placed on. The problem is when I drop a SCNNode(this has been consistent whether it was a box, pyramid, 3D-model, etc.) onto the plane, it will eventually find a spot to land and 99% start jiggling all crazy. Very few times has it just landed and not moved at all. I also think this may be cause by the node being dropped and landing slightly below the plane surface. It is not "on top" neither "below"

SceneKit nodes aren't changing position with scene's root node

北城以北 提交于 2019-12-05 04:02:26
问题 I'm using SceneKit with ARKit, and right now have a simple app where I tap on the screen and it adds an ARAnchor and a SCNNode to my scene. At some point, I'm going to want to move the entire scene, so I tried changing sceneView.scene.rootNode.position.x += 10 to test this out. If I call this on any particular node, that node does move appropriately. But calling this on rootNode , nothing happens, where I'd expect every child node (which is every node in the scene) to move along with it. Why

Node group's position is reset at the start of SCNNode.runAction

时光怂恿深爱的人放手 提交于 2019-12-04 05:38:31
问题 I have some code that rotates several SCNNodes around the x axis when the screen is tapped like so: func handleTap(gestureRecognize: UIGestureRecognizer) { let sceneView = self.view as SCNView let slice = self.cubes[0...8] let container = SCNNode() for node: SCNNode in slice { container.addChildNode(node) } sceneView.scene!.rootNode.addChildNode(container) container.runAction(SCNAction.rotateByX(CGFloat(M_PI / 2), y: 0.0, z: 0.0, duration: 1), completionHandler: { () -> Void in println(