scenekit

iOS12 is causing an error on Metal Command Buffer execution, render is glitchy or doesn't occur

戏子无情 提交于 2019-12-03 17:06:46
问题 We have an app that uses Metal to render. This app works correctly on devices running iOS11. When using the same app on devices running iOS12, we started getting glitches and sometimes hangs in the rendering. We also tried recompiling for iOS12 and are getting the same bad behavior. On the console we are getting the following different messages: 2018-09-22 09:22:29.508576-0500 OurApp [1286:84481] Execution of the command buffer was aborted due to an error during execution. Discarded (victim

SceneKit: How to detect contact without collision

老子叫甜甜 提交于 2019-12-03 16:20:15
I'm looking for the best way (performace-wise) to detect contact between two objects that do not collide (not bounce off each other) in a SceneKit physics world. I saw that SpriteKit has a contactTestBitMask and a collisionBitMask for physics bodies while SceneKit only has the latter. So there must to be another preferred way to get notified when objects have contact in SceneKit. I guess that calling contactTestBetweenBody:andBody:options: in each frame for each object is not the best way to do it? UPDATE With iOS 9.0, Apple has added contactTestBitMask to SCNPhysicsBody . So this question

SceneKit - Get the rendered scene from a SCNView as a MTLTexture without using a separate SCNRenderer

你。 提交于 2019-12-03 16:09:56
My SCNView is using Metal as the rendering API and I would like to know if there's a way to grab the rendered scene as a MTLTexture without having to use a separate SCNRenderer ? Performance drops when I'm trying to both display the scene via the SCNView and re-rendering the scene offscreen to a MTLTexture via a SCNRenderer (I'm trying to grab the output every frame). SCNView gives me access to the MTLDevice , MTLRenderCommandEncoder , and MTLCommandQueue that it uses, but not to the underlying MTLRenderPassDescriptor that I would need in order to get the MTLTexture (via renderPassDescriptor

SceneKit won't scale a dynamic body

自作多情 提交于 2019-12-03 15:44:05
I have a sphere that is a dynamic body. I would like to animate the scale of this sphere so that it grows in size: let sphere = SCNNode(geometry: SCNSphere(radius: 1)) scene.rootNode.addChildNode(sphere) sphere.physicsBody = SCNPhysicsBody.dynamicBody() sphere.runAction(SCNAction.scaleTo(10, duration: 1)) However, this does not seem to work. The sphere falls down due to gravity, but stays the same size. If I comment out the line that gives the sphere its physics body, then the scaling animation plays out like it should. This strange phenomenon is even observed without an animation. Simply

What is Core Audio error 561015905 and why does it happen when I use the lock button?

别来无恙 提交于 2019-12-03 15:40:13
Since upgrading to iOS 10 and Xcode 8, my iOS app has been throwing an error and crashing whenever I turn off the screen using the lock button. The error is: *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error 561015905' I'm not explicitly using Core Audio, or any audio at all. But I am using SceneKit, which I assume uses Core Audio. Actually this behavior doesn't seem to be related to my code at all. It happens on a brand new untouched SceneKit template! It doesn't happen in the simulator, but it happens consistently testing with an iPhone 5. I haven't

Importing .scn file to scene from URL with textures

久未见 提交于 2019-12-03 15:36:13
I am using ARKit for my application and I try to dynamically load .scn files from web-server Here is a part of my code let url = URL(string: "http://192.168.0.31:1234/5a27e09cbad20a7a03ad5d80/box/box.scn") if let objectScene = try? SCNScene(url: url!, options: [.overrideAssetURLs: true]) { print("load success") let node = SCNNode() for childNode in objectScene.rootNode.childNodes { node.addChildNode(childNode) } sceneView.scene.rootNode.addChildNode(node) } else { print("error loading") } here box.scn contains textures. And I got an error Failed loading: C3DImage 0x1c00f6f80 src:file:///var

How do you play a video with alpha channel using AVFoundation?

自闭症网瘾萝莉.ら 提交于 2019-12-03 14:24:18
I have an AR application which uses SceneKit , and imports a video on to scene using AVPlayer and thereby adding it as a child node of an SKVideo node. The video is visible as it is supposed to, but the transparency in the video is not achieved. Code as follows: let spriteKitScene = SKScene(size: CGSize(width: self.sceneView.frame.width, height: self.sceneView.frame.height)) spriteKitScene.scaleMode = .aspectFit guard let fileURL = Bundle.main.url(forResource: "Triple_Tap_1", withExtension: "mp4") else { return } let videoPlayer = AVPlayer(url: fileURL) videoPlayer.actionAtItemEnd = .none let

How do I create a HUD on top of my Scenekit.scene

心不动则不痛 提交于 2019-12-03 12:11:54
I'm experimenting with Swift and Scenekit. Building a Mac OS X app. It seems quite easy to get a 3d-scene working. But what is scene without some kind of 2D hi-score, radar display, speed indicator, etc? I would expect a SpriteKit-scene to seamlessly integrate into a SceneView but I don't find the documentation very clear about this.. The most obvious and only way I can think of is to position a SKView over a SceneView and render each separately. But is there a more elegant way? try scnView.overlaySKScene = aSKScene; (see SCNSceneRenderer.h) This is the recommended way. An alternative way is

Scene Kit Performance with cube test

拈花ヽ惹草 提交于 2019-12-03 11:56:15
问题 In learning 3d graphics programming for games I decided to start off simple by using the Scene Kit 3D API. My first gaming goal was to build a very simplified mimic of MineCraft. A game of just cubes - how hard can it be. Below is a loop I wrote to place a ride of 100 x 100 cubes (10,000) and the FPS performance was abysmal (~20 FPS). Is my initial gaming goal too much for Scene Kit or is there a better way to approach this? I have read other topics on StackExchange but don't feel they answer

How do you get positional audio to work in SceneKit?

坚强是说给别人听的谎言 提交于 2019-12-03 10:22:40
问题 I am having trouble getting positional audio to work in SceneKit. Starting with the SceneKit game template generated by Xcode I have added the following code to the end of the handleTap method: let ship = scnView.scene!.rootNode.childNode(withName: "ship", recursively: true)! if let source = SCNAudioSource(fileNamed: "art.scnassets/monoAudioTest.wav") { source.volume = 1 source.isPositional = true source.shouldStream = true source.loops = true source.load() let player = SCNAudioPlayer(source: