Xcode's SceneKit editor renders .dae file's wrong and Xcode sometimes crashes during preview - ios

I'm trying to figure out how to import .dae files with animations into Xcode and SceneKit.
It works somewhat, but it's really buggy, I can't preview files, and Xcode sometimes crashes when trying to preview the .dae files in Xcode.
Here's how I'm importing the animated models
I download an animated character from Mixamo, as a Collada file, with the settings below.
Create a brand new SceneKit iOS project, import .dae file, and select the file in the Xcode file list to preview it. The result can be seen below. I have zoomed all the way out to make sure I'm not just viewing the model from the inside of the mesh. The lines extend infinetly it looks like.
If I use the ConvertToXcodeCollada workflow, and verify that the .dae XML only has one <animation> tag with corresponding closing tag, and then import it into Xcode, it won't open at all. See image below.
If I import the .dae file version not converted using ConvertToXcodeCollada, and the add .dae file as a sub reference in a .scn Scene file, the model displays correctly, and the animation is playing correctly. Image below.
So how should I do this properly?
I have also tried to import animated models into Blender and then export it to Collada from there (with unstructions from tutorials on youtube), and same results. Is there a way I can do this a proper way, where it works like it should, without Xcode behaving buggy? It would be easier if I could actually preview and edit materials etc of the .dae files directly, without having to always add them to an existing .scn Scene Kit Scene.

I did followed your instructions and try to load a 3D animation. Its working fine for me
In new sceneKit project I have updated my code like.
// create a new scene
let scene = SCNScene(named: "Jumping.dae")! //"art.scnassets/ship.scn")!
and this too
let ship = scene.rootNode.childNode(withName: "mixamorig_Hips", recursively: true)! // "ship"
I am using XCode 10.1 on macOS 10.13.6

This happen when I try to open in finder a .dae file with animation created with mixamo
https://www.mixamo.com/#/
mojave OS 10.14.1
BUG Fixed by apple 10.14.2

I have downloaded which you mentioned above link. github.com/eh3rrera/ARKitAnimation
And I opened in finder. Its working for my mac

Related

Does Xcode 11.2 scene editor allow adding components?

Using Xcode 11.2 I can create a new project using the "Game" template. I can include for "Game Technology" SpriteKit and check "Integrate GameplayKit". If I run the code at this point on an iPhone 11 Pro iOS 13.2 simulator I see the "Hello, World!" label. If I go into the Library and add a Color Sprite at position (0,0) to the GameScene.sks file when I run I see the red Color Sprite. My problem comes when I add a Swift file with the content
import GameplayKit
class MovementComponent : GKComponent {
override func update(deltaTime seconds: TimeInterval) {
print(seconds)
}
}
and use the components editor in Xcode to add this component to the Color Sprite. When I run this I get a grey screen. When I check the GameViewController file I see with the debugger that scene.rootNode is nil. What's going wrong? I just want to see how to integrate a component with a Color Sprite using the components editor. Does this stuff work at all or is this just for WWDC demos?
Appears to be a bug in Xcode 11.2. Following the steps above the behavior appears correct for Xcode 10.3. Filled out Apple Feedback FB7427190. Thanks Knight0fDragon for helping identify where the problem was.
I guess my post today is a duplicate of this post.
SKScene not loaded when add GKComponent to GameScene.sks
It seems that the problem still exist in Xcode 11.3.1
If there is no component added in the scene editor to a SKSpriteNode I see that the scene is completely loaded as GameScene.sceneDidLoad is called.
If there is a GKComponent added in the scene editor. The GameScene is not loaded - GameScene.sceneDidLoad is never called.

SpriteKit .sks Files Crash Xcode 10 When Assigning Texture

Am I missing something obvious?
For reasons unknown, Xcode 10 keeps crashing on me when I go to assign a texture to a named sprite using the Scene Editor. After having to delete and recreate my .sks files a couple times, I decided to try and reproduce the issue using Xcode's game template. The steps I took to do this are as follows:
Open Xcode and select Create a new Xcode project.
Choose the Game template, name the project Test and save it somewhere, i.e. your desktop.
Drag any image asset into Assets.xcassets. I used this green square:
Open GameScene.sks and drag a Color Sprite onto the scene.
Name the sprite something descriptive like square_green.
Attempt to set the texture in this field:
Other similar questions on Stack Overflow:
Xcode is crashing in SpriteKit
XCode 9 Crashing while setting a Texture in SKScene in Spritekit
If I do not set a name for the color sprite prior to assigning a texture, everything works fine. However, if Xcode is forced to crash at least one time, I have to delete the .sks file completely just to get Xcode to open again.
For the time being I've decided to avoid the trouble all together and just assign the textures programmatically in the didMove(to:) of my SKScene class:
override func didMove(to view: SKView) {
let greenSquare = childNode(withName: "square_green") as! SKSpriteNode
greenSquare.texture = SKTexture(imageNamed: "square_green")
}
I ran into the same problem, and later I moved the images out of Assets.xcassets and the problem was solved. I guess the image can't be placed in Assets.xcassets.

Xcode jump from viewcontroller.swift to storyboard

I'm working on a large ios app and I'm also a newb. I'm trying to find the correct scene in a storyboard in a large app. I'm in the .swift file and I need a quick way to figure out which scene is associated with that swift controller file. The only way I know now is to go through each scene and look at the Class property, which will take forever. Is there a shortcut to jump from the swift file to the associated scene?
In Xcode, open "Find in Workspace..." (Command+Shift+F)
Type the name of your ViewController.
In the results panel, check the entries under the .storyboard file. Clicking on them will open that exactly scene in the Interface Builder.
Profit.
You can also go further and filter the search by filetype. Check this out:
Create a custom Scope:
Super awesome result:

Xcode doesn't find assets which have been imported before

I try to play music with the AVAudioPlayer of the AVFoundation.
The line triggering the player is this one:
playBackgroundMusic("background-music-aac")
I previously imported the file (.caf) as you can see here:
http://i.stack.imgur.com/UJ3Fr.jpg
Still Xcode can't find it, as you also can see in the image.
When you select the audio file background-music-aac make sure that it will be compiled with your target. Please check if it is selected on your File Inspector on the right hand panel of Xcode.

XCode Has No Option to Enable Texture Atlas Generation

I'm following along with this apple doc, but for some reason when I search for "Sprite" under Build Settings in XCode nothing pops up. I've also tried searching for "Enable Texture Atlas Generation" and nothing comes up.
I have Xcode 5.0.2 if that helps.
The SPRITEKIT_TEXTURE_ATLAS_OUTPUT settings will be there in a new project but the SpriteKit Deployment Options will be created later. Of course you must select SpriteKit Game template when you create the project.
These settings added automatically to your project when you add the first texture atlas resource to it. You need to add a folder named with the .atlas extension. For example you have textures for your hero the atlas should be named as hero.atlas.
I was bedeviled by this exact issue for the past day, when I discovered that if I add an atlas to the project by dragging and dropping, the Sprite Kit Texture Atlas Options were not added to the Build Settings. If I chose File > Add Files to... from the menu bar, however, the Sprite Kit Texture Atlas Options appeared in the Build Settings.
So, apparently, do not drag and drop to add a texture atlas.

Resources