scnscene

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

ARKit : Make virtual 3D objects to point towards camera

懵懂的女人 提交于 2021-02-08 03:46:48
问题 I am trying to build an app based on ARKit to place 3D virtual objects on to the plane that is detected. I found a useful project on GitHub Placing Virtual Objects This does the job exactly what I am looking for. However, when any virtual object is placed in front of the camera, it may or may not face the camera. Sometimes 3D objects look in the opposite direction of camera I have tried to add SCNconstraints to virtual object node and tweak the rotation and orientation of 3D Models to look at

ARKit : Make virtual 3D objects to point towards camera

微笑、不失礼 提交于 2021-02-08 03:46:28
问题 I am trying to build an app based on ARKit to place 3D virtual objects on to the plane that is detected. I found a useful project on GitHub Placing Virtual Objects This does the job exactly what I am looking for. However, when any virtual object is placed in front of the camera, it may or may not face the camera. Sometimes 3D objects look in the opposite direction of camera I have tried to add SCNconstraints to virtual object node and tweak the rotation and orientation of 3D Models to look at

Check if SCNNode SCNAction is finished

爷,独闯天下 提交于 2021-02-07 03:15:05
问题 I have created a SceneKit 3D maze world in which a player can move. Some of the moves like jumping involve moving the camera up and down while changing to view direction over a period of time of several seconds. During this time I would like to ignore taps and swipes by the user that would normally result in other types of movements like turning and moving forward. I could create a timer that matches the jump duration and sets a Bool but I was hoping for a simplier way of checking the SCNNode

Check if SCNNode SCNAction is finished

南笙酒味 提交于 2021-02-07 03:13:15
问题 I have created a SceneKit 3D maze world in which a player can move. Some of the moves like jumping involve moving the camera up and down while changing to view direction over a period of time of several seconds. During this time I would like to ignore taps and swipes by the user that would normally result in other types of movements like turning and moving forward. I could create a timer that matches the jump duration and sets a Bool but I was hoping for a simplier way of checking the SCNNode

ARKit - How to load .scn and texture file from server URL

橙三吉。 提交于 2021-02-06 09:19:04
问题 I try to load dynamically .scn and texture files from server URL in ARKit application. I have achieved loading .scn file from web url this way.. But after running I am not seeing any textures on device. I get following error message. ARKitExample[3016:995067] [SceneKit] Error: Failed loading : <C3DImage 0x1d42e1980 src:file:///var/containers/Bundle/Application/622ACF79-2318-4953-A9AE-9A7F2B453AFB/ARKitExample.app/textures/lamp_DIFFUSE.png [0.000000x0.000000]> ARKitExample[3016:995067]

ios - Could not open OBJ file when convert MDLAsset to MDLMesh

与世无争的帅哥 提交于 2020-01-05 02:32:48
问题 I'm working with demonstrating loading and texturing a .OBJ file using ModelIO . This code bellow works fine when I use local file . guard let url = Bundle.main.url(forResource: "myVase", withExtension: "obj") else { fatalError("Failed to find model file.") } let asset = MDLAsset(url:url) guard let object = asset.object(at: 0) as? MDLMesh else { fatalError("Failed to get mesh from asset.") } But, when I change my code to use file from my Amazon S3 instead of local file. I got errors: "Could

Get All ARAnchors of focused Camera in ARKIT

那年仲夏 提交于 2019-12-21 06:15:48
问题 When application launched first a vertical surface is detected on one wall than camera focus to the second wall, in the second wall another surface is detected. The first wall is now no more visible to the ARCamera but this code is providing me the anchors of the first wall. but I need anchors of the second wall which is right now Visible/focused in camera. if let anchor = sceneView.session.currentFrame?.anchors.first { let node = sceneView.node(for: anchor) addNode(position: SCNVector3Zero,

ARkit - Loading .scn file from Web-Server URL in SCNScene

ε祈祈猫儿з 提交于 2019-12-03 07:35:51
问题 I am using ARKit for my application and I try to dynamically load .scn files from my web-server(URL) Here is a part of my code let urlString = "https://da5645f1.ngrok.io/mug.scn" let url = URL.init(string: urlString) let request = URLRequest(url: url!) let session = URLSession.shared let downloadTask = session.downloadTask(with: request, completionHandler: { (location:URL?, response:URLResponse?, error:Error?) -> Void in print("location:\(String(describing: location))") let locationPath =