I have a .dae file, which I'm trying to import into Xcode. Once I import, the object's Z-axis points upwards and Y-axis points downwards. Which actually should be vice versa. How to fix this issue?
The below image shows, how z-axis is facing top.
Change the camera view to see the file on the perspective you want. See the image below.
Hope this helps.
This just a compatibility issue. Model exported by modeling software usually has size or position issue.
You can set it in scene editor.
Scene Editor
And the image below shows the way to change camera view.
Camera View
Related
I'm looking for a setup in manim (0.8.0 CE) where I have in the main part of the screen an ambiente camera plus two addtional views on the right hand side (like a picture in picture, or split screen) from a fixed diffrent angle on the scene. I've found a MultiCamera Class, but this is fixed to a MovingCamera. I assume that I need additional three_d_camera objects, but couldn't find any example in any of the tutorials which points me in the right direction. Are there any ideas how to do this?
I am exporting 3D models from Cinema4D with .dae file format, and drag them into art.scnassets. Every time I compile the project the 3D object are too big or not in the right position. What is the best setting for models which we want to use in iOS ARKit ? I have search many topics and still not a final solution.
Edited :
I have found that if your object is for instance 50cm in cinema, you need to export it as .dae (1.4, important!) and then select 0.001 meters as scale.
Also, make sure that you position the object at 0, 0, 0 (even if you want it positioned somewhere else in the end, centering it will make editing & repositioning in Xcode easier).
After importing, inside Xcode, click on the .dae file. Select the object in the scene, open the right inspector menu and navigate to the identity inspector.
Then press is movable. This will convert the file to .scn which is better for editing. (is movable should still be unchecked after conversion, if not uncheck, or leave as is)
Then, open the new .scn file and click on your object. You'll see its scale on the right in the identity inspector. If it's still not right, you can change the scale of the bounding box there and also position the object in the scene.
If I run Xcode's ARKit project template, I can move around the default ship as expected.
I have tried importing some dae models that I have exported from Blender, switching the ship to the new item but keeping the code the same. They always show in view but position in front the camera. If I try to move around the model it sticks infront of the camera and doesn't stay in the same virtual space.
I have also tried importing a dae from another tutorial and that works as expected.
Does anything need setting when exporting a 3d model as a Collada dae file to make sure it will anchor to a position in ARKit?
When importing 3D-models for ARKit make sure to check:
the scale of your file. One unit equals 1 meter
The model should be centered in the coordinate origin to make it easy to position the model
Try to import the file in the SceneKit editor in Xcode and check if it gets imported correctly.
I am attempting to experiment with Apple’s Fox game SceneKit example (link below) by adding a model with a simple animation like the ‘panda.scn’ and ‘walk.scn’ assets.
I can create a static model with no joints or animation that works: e.g. In Maya (2017) I add a simple sphere, export selection to FBX_DAE (COLLADA) file, drag it into the project in XCode and convert it to a SCN file. I can then drag that model into the ‘level.scn’, position and scale it as I’d expect.
However as soon as I add any animation or joints to my model I lose the ability to position and scale the model in XCode.
In Maya I add two joints to my sphere select the sphere and joints and export as above. When I examine the model SCN in XCode (either in isolation or as a reference within another scene) I find that I cannot apply any translation or scaling. XCode lets me move the xyz locators in the GUI and update scale but the model does not change. I can see the mesh and joints in the outline view and I have tried moving the joints instead of the mesh, but they do nothing. I have even tried ignoring the GUI and positioning the model in code just as the panda character is set up, but applying positions or transforms to the node does nothing - it always appears at the origin and default scale.
Ignoring that for the moment, my understanding from looking at the ‘walk.scn’ file is that an animation is just an export of the joints with keyframes. I have tried to reproduce that by exporting only the joints to a separate DAE and importing it, then applying that in code as they do with the ‘walkAnimation’. This seems to do nothing as well.
I have experimented with various settings of the FBX_DAE export dialog including baking animations (By the way - what is the difference between baking an animation on export vs baking it in Maya before export? The former seems to do something and the other does nothing in my tests.)
I would dearly love a workflow for creating some simple character animations in Maya and getting them into SceneKit. Any help is greatly appreciated.
For reference:
Apple’s source: https://developer.apple.com/library/content/samplecode/Fox/Introduction/Intro.html
Maya scene for my trivial ball model with two joints:
http://pat.net/misc/ball1.mb
and the DAE output from Maya for that:
http://pat.net/misc/ball1.dae
UPDATE:
Mnuages's answer appears to be correct in that when I added a parent control over the geometry and joints SceneKit then allowed me to move them. But even after brushing up on my understanding of how these nodes and their transforms relate in Maya I do not feel that I have a real understanding of how SceneKit is interpreting them. (Would love to read some docs on that would illuminate this more if they exist).
UPDATE #2:
I was finally able to create an animation by doing the following: 1) Export either the full scene or just the joint with the animation being sure to select the "bake animation" option in the DAE export dialog or bake the entire animation using Key->Bake Animation. 2) It only works if I load the DAE file in scenekit instead of converting it to an SCN. Converting to SCN format seems to lose the animation.
what happens is that the node named joint1 is animated by the joint1-anim animation. So even if you move joint1 in the editor, what you see on screen is the result after the animation is evaluated.
If you create an intermediate node, say joint1-parent, and make joint1 as child node of joint1-parent, then you'll be able to translate and rotate joint1-parent freely and see the effects on joint1.
As for why moving pSphere does not change anything, it's the same idea. Just like the animation overrides the position, the skeleton will reposition the mesh.
I'm not sure what the issue is, but I'm trying to design a level in Apple's Sprite Kit editor, and I'm running into a problem with SKSpriteNodes that have a transparent background. Sometimes the background doesn't appear as clear. Instead, SpriteKit seems to load a Red X as a background image.
Naturally, I can't have this. Also, it's a problem because I really should be doing all of the level design in the editor instead of manually adding sprites in my Scene code.
Has anyone come across this problem? Could it be a bug in SpriteKit Designer? (There are a number of issues I've had with it since starting to use the tool).
Here is a photo of what it looks like:
I found a kinda hacky way to solve it. Basically, as uchuugaka said, the Red X appears when Sprite Kit fails to load a texture. If you want a clear background, you have to load a clear png file as the background of the sprite. There is no "No Texture" option currently available in the Sprite Kit designer.
Take these steps.
1.) Open any .png file with some transparency in it.
2.) Copy an arbitrary rectangular section of pixels.
3.) Create a new file with said arbitrary pixels.
4.) Save this file as your "clear.png" and import it into your project.
5.) Click on the sprite node with the Big Red X so you can see its setting. Take a screenshot of its position, size, etc. using preview. These settings will get erased when you swap the texture over to clear.png
6.) Swap the texture to clear.png
7.) Re-enter the sprite settings from your screenshot.
8.) Because SpriteKit Editor is currently horribly terribly flawed (see post above), you will need to reset your sprite's physics properites. Set the physics body to none. Then set it to bounding box or circle or alpha mask or whatever you had earlier.
9.) I hope you remembered your collision mask, category mask, and other physics body properties because they just got reset to the default. Re-enter what you had earlier or you will get a very unexpected result.