This question already has an answer here:
SceneKit – Animation with DAE file format
(1 answer)
Closed 7 years ago.
I can’t get animations in SceneKit work correct. I’d like to build a beautiful game in 3D but I get stuck with a very simple and basic thing like animation :-(
I saw WWDC 2015 session 606 and was very impressed and start to build my game using sample code from Fox project (https://developer.apple.com/library/ios/samplecode/Fox/Introduction/Intro.html).
Steps I’ve made:
created a cube in 3d tool (Cheetah 3d) and export it in cube.dae
create skeletal animation (just a simple rotation) for cube and export only skeleton without mesh in cubeAnimation.dae
copy cube.dae and cubeAnimation.dae into Xcode project and convert them in cube.scn and cubeAnimation.scn
using Apple sample code (Fox project from WWDC 2015 session 606) add cube.scn on a scene
5. using Apple sample code (Fox project from WWDC 2015 session 606) add cubeAnimation.scn animation to cube.scn
build and run project ––> cube.scn is rotating BUT cube.scn resets it’s initial position to one that is in cubeAnimation.scn
Thinking that my 3d tool (Cheetah 3d) export in Collada with some issues I’ve tried to use models created by other developers but result was the same. I’ve tried to use Autodesk Maya to export animations but result was the same. I even tried to use model from Unreal Engine example (https://wiki.unrealengine.com/File:ThirdPerson_FBX.zip) but result was the same.
I put Xcode project source here https://www.dropbox.com/s/8vtmem4jqnetmwd/XcodeProject.zip?dl=0
I put models and animations source here https://www.dropbox.com/s/qkkbfhk7wrz4r4z/ModelsAndAnimations.zip?dl=0
Maybe there are some special Collada export settings to make animations work correct?
If the animation in cubeAnimation.scn animates matrices, then it is expected that this animation control the position, rotation and scale. If the keyframes contains rotations (euler angles, axis angles or quaternion) then it will rotate the busy without reseting its position.
So this depends on how the exporter exported the animation. (For example I know 3dsmax can export individual animation for translation / rotation /scale until you explicitly ask to "bake transforms").
A workaround is to have your skeleton centered in 0,0,0 in cubeAnimation.scn and use an intermediate node to move your cube in cube.scn
It seems it was my mistake, I didn't include rig in initial model when exporting to .dae. I only include rig in animated model.
Related
I create one new SceneKit Game in oSX, and drag the panda.scn and walk.scn from Apple WWDC FoxBuildingaSceneKitGamewiththeXcodeSceneEditor sample code into the project, it animates.
But when I create my own 3D model and animation, it doesn’t work.
If there is vetex group int he animation, XCode throw error, there is one joint in the DAE. Then how to design animation in Blender without vetex group?
if there is sub-bone in the DAE for animation, XCode also throw error on joint.
Appreciate anyone could share one complete sample with simple geometry and simple animation (vetex group?), which can run in XCode.
Thanks.
I have followed below steps on export DAE.
how to export and set up animation files from Blender3D
I've been working with an animator to help with my game. The animations all work fine using morph targets, but the file size just gets way too large. Skeletal animations are the answer. We've spent a week working to get the animations exported from blender correctly.
After reading many many articles we were able to get basic animations working correctly. I make sure to set the armature to rest pose and export on the first frame and all that, but the more complicated animations are off.
You can see in this example here (click to cycle animations):
http://www.titansoftime.com/beta/animation2.html
My animator said the problems are related to bone constraints using his controllers. He said his technique is called "Inverse Kinematics".
Anyone have any ideas?
I have found the answer. For one you can not scale the geometry in the json loader (however you can scale the mesh object once created).
The main thing is that my animator was using inverse kinematics, which apparently three.js does not play nice with.
I am having an issue in unity. I have an animated model made in blender imported into unity. When the scene starts the model is the correct size and is at 0,0,0. When trying to use a java script to play an animation the model moves about a meter and scales by about half, the animation does play on the small model. The model was made in blender and is not anything out of the ordinary, the animations play in blender with out any issues. It was imported as a blender file not an fbx. Trying to import it as an fbx produced too many issues. The import did not cause any issues but two things of note: the rig was imported with -90x rotation and the animations can only be used as lagacy. The java script is not complicated it is only using "animation.CrossFade( "english_hook" );" or any of the other animations. I have tried to see if anyone else on the internet has seen this issue but either they ave not or I am not searching for the right problem. I am fairly new to unity and have moderate exprience in blender. Has anyone seen this kind of issue, know how to fix it or have any ideas?
Are you using Unity4? You might have to mark your animation as legacy, open your imported model in unity inspector, select "Rig" tab and set your animation to legacy.
I am beginner to medium skills, I can create mesh with many polygons, I need to texture map it, those i can handle, but, how to make it Roll Up and UnRoll (I can handle the keyframe animation - but, i just don't know what to do to make the carpet unroll or rollup. Can be carpet or roll of paper towels, just need to know how to do the effect? There are tutorials how to do it with Cinema 4D or Maya - but, i want to do it on the website within the Three.js framework. Any ideas ???
Or is there a way to export the animation data from, say, Blender or Maya?
Thanks
Maybe this one?
http://mrdoob.github.com/three.js/examples/webgl_animation_cloth.html
Let's search for a tutorial on youtube to create the animation in Blender or in Maya
(e.g.: http://www.youtube.com/watch?v=tN_FZiTbaG0)
Create your animation and export your scene into collada (.dae) format
Use the collada loader "webgl_loader_collada_keyframe.html" example file to run your animation. (Replace "pump.dae" with your just exported animation in the example file.)
you could also try using this as3mod port for three.js to manually "roll" a plane. http://nikos-web-development.netai.net/blog/mod3-a-javascript-port-of-as3mod-for-three-js/
I've acquired a great quad model. I skinned and animated it to a rig build by a
Mel script. It works great as far as editing the animation using sliders and parameters
in Maya. When I export the file as an FBX file to Unity3D, it does not animate. Is something
being lost in the translation from Mel to the rig? Unity needs a boned rig, is this procedural rig not the equivalent of a rig built and animated with the skeleton tools in Maya? I've check that I have a 'Reference' folder, I've set keys, changed root name to "Hips".
Thanks for any insight on this question.
dDuane
If you are transferring the file with no errors and there is no animation then there are three issues to look at.
First, you may have accidentally not exported the keyframes. Make sure the box is checked to export animation on the FBX export UI.
Second, it's possible that the object that contains the actual keyframes is not being exported. When you animate using the MEL scripted GUI, find out where the actual keyframes are on the rig and make sure that object is exporting with the rest of the character.
Third, the object might be transferring fine but depending on the rig setup the connections/constraints/whatever might not be working or supported in Unity. You might consider baking the animation to the skeleton before transferring to the engine. To do this, select the skeleton, click [Edit -> Keys -> Bake Simulation].
I don't know what Maya you are using, but I've always used 2010. This is the workflow that we used for a small unity 3D game project:
Export all of the
animations in one scene as a .fbx. Be sure you just select the geometry (it
usually helps to have it all grouped, but if you can't for some reason that's
okay) and hit export selected.
These FBX export options should be checked:
Geometry:
Edge smoothing,
Tangents and Bi-normals
Animation:
Animation,
Bake Animations,
Bake Animations,
(range of animation),
step = 1
Deformed Models:
Deformed Models,
Skins,
Blend Shapes (if using these),
Curve Filters,
Resample as Euler Interpolation,
Input Connections,
Instances to Objects,
Referenced Containers Content (if using any references),
FBX File Format
Binary
FBX200900
When you bring this into Unity, set animation generation
to "store in root." If all of your
animation is in this one file (which it should be). The "split
animations" box should be checked and define the names and range of these in the
chart below. When you eventually create an animation blending script, drag
and drop it on the animation object within the player prefab, not the prefab
itself.