scenekit

ARKit - place a SCNPlane between 2 vector points on a plane in Swift 3 [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-10 10:14:17
问题 This question already has an answer here : Scenekit shape between 4 points (1 answer) Closed last year . Similar to some of the measuring apps you can see being demonstrated in ARKit, I have a plane with 2 marker nodes on it and a line drawn between the 2. What I need though is an SCNPlane between the 2. So, if your original was the floor and you put a marker either side of a wall, you could represent the physical wall with a SCNPlane in your AR world. Currently I'm placing the line with the

How to solve SceneKit double not supported error?

寵の児 提交于 2019-12-10 09:28:29
问题 I have been looking into SceneKit for iOS over the past couple of days. I came across an issue when trying to create custom geometry. Whenever I tried to display the geometry, it would not draw, and show me this error during runtime. SceneKit: error, C3DRendererContextSetupResidentMeshSourceAtLocation - double not supported I created a playground targeting iOS to test a more simple example of custom geometry, and looked into this question about custom geometry using swift vs objective c. I

Swift 3.0 how to use startDeviceMotionUpdates(to: withHandler)?

本小妞迷上赌 提交于 2019-12-10 09:27:28
问题 Swift 3.0 was released alongside Xcode 8.0 and apparently a lot has changed. I'm very unfamiliar with the new syntax in swift. Can someone help me out? I'm trying to figure out what goes in motionManager.startDeviceMotionUpdates( to: OperationQueue.current()!, withHandler: ) after the "withHandler:" I am trying to get my SceneKit program be able to utilize the accelerometer to determine the orientation of an SCNNode platform. I am also fairly new to swift (about 5 days into programming in

Why is SCNNode “jiggling” when dropped onto SCNPlane?

眉间皱痕 提交于 2019-12-10 07:39:08
问题 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

SceneKit SCNNode init(mdlObject:) missing?

[亡魂溺海] 提交于 2019-12-10 00:56:48
问题 I'm using Xcode 7.3.1, Swift 2.x, iOS target is 9.3. I can find convenience init init(MDLObject mdlObject: MDLObject) in Apple docs, but I don't see it in my project. I opened standard game project starter, SceneKit is imported. I've tried: Double checking iOS version Adding import ModelIO Finding "mdlObject:" in header files in SceneKit.framework - not found Looking for alternative methods (maybe Apple moved it somewhere) but there are no other inits with that parameter, no class function,

Render a 3D model (hair) with semi-transparent texture in SceneKit?

微笑、不失礼 提交于 2019-12-10 00:19:40
问题 I'm trying to render a 3D model in SceneKit but it looks incorrect. For example this model (it's an SCN file with texture and you can reproduce it in your Xcode): In Xcode Scene Editor it is rendered like this: Transparency -> Mode -> Dual Layer Double Sided = true If I turn off the "Write depth" option, it will look like this: But there are also some issues because it I see only "the lowest layer" of haircut. I think this should be possible. How to do it right? 回答1: The reason that in your

Color keying video with GPUImage on a SCNPlane in ARKit

南楼画角 提交于 2019-12-10 00:02:54
问题 I am trying to play a video, showing transparency in an ARSCNView . A SCNPlane is used as a projection space for the video and I am trying to color key this video with GPUImage . I followed this example here. Unfortunately, I have not found a way to project that video back on my videoSpriteKitNode . Because the filter is rendered in a GPUImageView , and the SKVideoNode takes a AVPlayer . I am not sure if it is possible at all, what I am trying to do, so if anyone could share their insight I'd

SceneKit get texture coordinate after touch with Swift

不羁岁月 提交于 2019-12-09 18:49:51
问题 I want to manipulate 2D textures in a 3D SceneKit scene. Therefore i used this code to get local coordinates: @IBAction func tap(sender: UITapGestureRecognizer) { var arr:NSArray = my3dView.hitTest(sender.locationInView(my3dView), options: NSDictionary(dictionary: [SCNHitTestFirstFoundOnlyKey:true])) var res:SCNHitTestResult = arr.firstObject as SCNHitTestResult var vect:SCNVector3 = res.localCoordinates} I have the texture read out from my scene with: var mat:SCNNode = myscene.rootNode

swift/scenekit problems getting touch events from SCNScene and overlaySKScene

会有一股神秘感。 提交于 2019-12-09 17:58:39
问题 Good afternoon, I'm trying to figure out how to get touch notifications from an SCNNode & a SKSpriteNode from an SCNScene overlayed with a SKScene. import UIKit import SceneKit class GameViewController: UIViewController { var scnView:SCNView! var scnScene:SCNScene! var sprite: spritekitHUD! var cameraNode: SCNNode! var shape: SCNNode! override func viewDidLoad() { super.viewDidLoad() setupScene() } func setupScene() { scnView = self.view as! SCNView scnView.delegate = self scnView

Render an SCNGeometry as a wireframe

大憨熊 提交于 2019-12-09 16:30:58
问题 I'm using SceneKit on iOS and I have a geometry I want to render as a wireframe. So basically I want to draw only the lines, so no textures. I figured out that I could use the shaderModifiers property of the used SCNMaterial to accomplish this. Example of a shader modifier: material.shaderModifiers = [ SCNShaderModifierEntryPointFragment: "_output.color.rgb = vec3(1.0) - _output.color.rgb;" ] This example apparently simply inverts the output colors. I know nothing about this 'GLSL' language I