scenekit

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 =

SceneKit presentScene(_withTransition:incomingPointOfView completionHandler) crash with dynamically loaded SCNScene

穿精又带淫゛_ 提交于 2020-01-04 11:42:03
问题 I'm trying to transition from one scene to another, but when I call presentScene there is a crash! The scenes are not stored in a class or referenced, they are loaded directly into the presentScene call. Screenshot of crash in Xcode: My simple minimal project is here: https://dl.dropboxusercontent.com/u/6979623/SceneKitTransitionTest.zip MKScene is just a subclass of SCNScene , because I would like to know when a scene is deinited to be sure that is it. self.gameView!.scene = MKScene(named:

SceneKit presentScene(_withTransition:incomingPointOfView completionHandler) crash with dynamically loaded SCNScene

╄→尐↘猪︶ㄣ 提交于 2020-01-04 11:40:13
问题 I'm trying to transition from one scene to another, but when I call presentScene there is a crash! The scenes are not stored in a class or referenced, they are loaded directly into the presentScene call. Screenshot of crash in Xcode: My simple minimal project is here: https://dl.dropboxusercontent.com/u/6979623/SceneKitTransitionTest.zip MKScene is just a subclass of SCNScene , because I would like to know when a scene is deinited to be sure that is it. self.gameView!.scene = MKScene(named:

set pivot of SCNNode to bounding volume center without changing the node's position

Deadly 提交于 2020-01-04 07:02:10
问题 I am looking for a way to set the pivot of SCNNodes (obtained from importing Collada files) to their centroid (or the center of their bounding box. I get the center with SCNVector3 center; CGFloat radius; [node getBoundingSphereCenter:&center radius:&radius]; However, when I try to set the node's pivot (which is a 4D vector as opposed to the 3D vector of the center) to the center, the node's position also changes. node.pivot = SCNMatrix4MakeTranslation(center.x,center.y,center.z); How can I

Godot took over .scn files in Xcode

我们两清 提交于 2020-01-03 19:16:14
问题 Recently installed Godot. Now Xcode will not preview .scn files. I can't change the type back to SceneKit as it isn't available in the dropdown list. 回答1: try this: Open finder and locate any file with the .scn extension. Click on Get Info Navigate to the session Open with: Select Xcode from the list and click in change all Hope it helps. 回答2: You can also right-click on the .scn file in Xcode's Project navigator and select Open As → SceneKit Document 回答3: Other answers did not work for me.

Godot took over .scn files in Xcode

[亡魂溺海] 提交于 2020-01-03 19:15:14
问题 Recently installed Godot. Now Xcode will not preview .scn files. I can't change the type back to SceneKit as it isn't available in the dropdown list. 回答1: try this: Open finder and locate any file with the .scn extension. Click on Get Info Navigate to the session Open with: Select Xcode from the list and click in change all Hope it helps. 回答2: You can also right-click on the .scn file in Xcode's Project navigator and select Open As → SceneKit Document 回答3: Other answers did not work for me.

Save ARFaceGeometry to OBJ file

夙愿已清 提交于 2020-01-02 11:03:10
问题 In an iOS ARKit app, I've been trying to save the ARFaceGeometry data to an OBJ file. I followed the explanation here: How to make a 3D model from AVDepthData?. However, the OBJ isn't created correctly. Here's what I have: func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { guard let faceAnchor = anchor as? ARFaceAnchor else { return } currentFaceAnchor = faceAnchor // If this is the first time with this anchor, get the controller to create content. //

SceneKit drops to 40 FPS

走远了吗. 提交于 2020-01-02 06:14:39
问题 Many times when I swipe iOS notifications from the top, and back to the app, then SceneKit fps drops to 40. Sometimes it happens also after minimising and maximising app. How come? Can this be overcome somehow? I tried pausing SceneKit when app becomes inactive, and resuming when it's back, but this is not helping. 回答1: I've noticed this, too. In several different frameworks that use constant frame refreshing or are tied to the CADisplayLink as part of their presentation process. I suspect,

SceneKit - Map cube texture to box

旧城冷巷雨未停 提交于 2020-01-02 05:46:04
问题 I've a texture for a cube that looks like I'd like to use it on a cube in a SceneKit view. I'm using the SceneKit geometry SCNBox for that. Unfortunately, the result is that the texture is projected entirely on each face, instead of using only the corresponding part: let videoGeometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0) videoGeometry.firstMaterial?.isDoubleSided = true videoGeometry.firstMaterial?.diffuse.contents = UIImage(named: "test")! I know I can use shader

Overlay SKScene is not showing

 ̄綄美尐妖づ 提交于 2020-01-02 05:33:12
问题 I'm trying to overlay an SKScene over a SCNScene. When I run my app on the simulator and an iPhone6+, the overlayScene(SKScene) is shown as intended, but when I tried running it on the iPhone5 (tried 2 different devices) the overlayScene does not appear. Does anyone have an idea why? Both device run on iOS 9.2.1. I have only tested the app on those two models. Here's my code inside the GameViewController.Swift //Configure the view sceneView = self.view as? SCNView //Configure the scene