2

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:

  1. created a cube in 3d tool (Cheetah 3d) and export it in cube.dae
  2. create skeletal animation (just a simple rotation) for cube and export only skeleton without mesh in cubeAnimation.dae
  3. copy cube.dae and cubeAnimation.dae into Xcode project and convert them in cube.scn and cubeAnimation.scn
  4. 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
  5. 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?

Manifestor
  • 575
  • 5
  • 19
  • If you want simple, and support, use Unreal Engine. If you want simple, slow and problematical, use Unity. If you want problems, use SceneKit. – Confused Dec 27 '15 at 14:53
  • Confused, maybe you're right :( and you have a big experience with scenekit/unity/unreal? – Manifestor Dec 27 '15 at 17:56
  • Enough to make that comment with sufficient authority to feel I'm not wasting your time making that comment. – Confused Dec 27 '15 at 18:21
  • I wish I had enough experience with scene kit to discredit it with a lavish bashing of its weak points. I don't. So I'll just point you to their online forums (at Apple). Go there, you'll enjoy reading the users complaining about the problems. Also check Sprite Kit to see how Apple deals with a game engine that's much more successful. – Confused Dec 27 '15 at 18:23
  • Then goto Unreal, and don't look back. – Confused Dec 27 '15 at 18:23
  • I've been at Apple developer forum many times and even wrote posts with similar problems about animation, but it seems that there is nobody who can help me. What do you mean by "how Apple deals with a game engine that's much more successful"? – Manifestor Dec 27 '15 at 19:32
  • It seems it was my mistake, I didn't include rig in model when exporting to .dae. – Manifestor Dec 27 '15 at 21:04

2 Answers2

2

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

Toyos
  • 4,024
  • 15
  • 16
1

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.

Manifestor
  • 575
  • 5
  • 19