Author Topic: Animation seems strange  (Read 2307 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Animation seems strange
« on: July 27, 2012, 07:02:48 am »
Maya2012 + OgreMax

First i made an dog-animation "run without position-moving"(which means the dog just run in situ). The animation played fine on my phone.

Then i changed the animation to "run with position-moving"(which means the dog run here and there). The .mesh and .skeleton runs fine in OgreMax-WinViewer. But when i played it on my phone(with .bones), something seemed to be strange:
 
  The dog's body moved, but the tail didn't move with the body. The tail seemed to stretched from origin position to where the dog's body moved to.

I tried jme3 with the same .mesh.xml and .skeleton.xml , evething was ok.

Shall i send the xml-file to you?

I will try .xml instead of .bones.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Animation seems strange
« Reply #1 on: July 27, 2012, 01:35:12 pm »
that's strange and shouldn't happen. can you please double check if it seems ok in OgreMax viewer and has a problem in Bones?

.xml or .bones shouldn't differ. .bones format is created by first laoding xml files.

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: Animation seems strange
« Reply #2 on: July 28, 2012, 12:32:46 pm »
I have checked again. The same mesh+skeleton played fine in OgreMax-WinViewer, but strange on phone with .bones(tail stretched). I am not sure how to use .xml instead of .bones, so i don't know if the result are some difference between them.  Could you do a test with my .xml? This problem bore me a long time. Thanks!

Here are my codes:

     
Code: [Select]
  //onSurfaceCreated
         AnimatedGroup group = BonesIO.loadGroup(mContext.getAssets().open("dog21.bones"));
        mGroup = group;
        for(Animated3D a : group)
        {
          a.setTexture("world");
          a.build();
        }
        mDog = group.get(0);
         group.addToWorld(mWorld);
      Camera camera = mWorld.getCamera();
      camera.setPosition(0, 0, 150);
      camera.lookAt(mDog.getTransformedCenter());
      camera.rotateCameraZ((float) Math.PI);
      mWorld.buildAllObjects();

      mFrameBuffer = new FrameBuffer(480, 800);
      MemoryHelper.compact();
       


// onDrawFrame

      mDog.setAutoApplyAnimation(false);
      mDog.animatePose(time_line, animation_index);
      mDog.animateSkin(time_line, animation_index);
      mDog.applyAnimation();

     time_line += 0.05 * speed;

      if(time_line > 1)
        time_line = 0.01f;

      mFrameBuffer.clear();
      mWorld.renderScene(mFrameBuffer);
      mWorld.draw(mFrameBuffer);
      mFrameBuffer.display();
           


Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Animation seems strange
« Reply #3 on: July 28, 2012, 05:14:59 pm »
ah you are using animation blending. that may be the cause. send me the files and let me have a look

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Animation seems strange
« Reply #4 on: July 28, 2012, 05:26:27 pm »
Quote from: kiffa
I am not sure how to use .xml instead of .bones, so i don't know if the result are some difference between them.
have a look at OgreSample to see how to load Ogre xml files directly. but that is both slower and requires Ogre3D jars on classpath, that's why .bones format is preferred

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: Animation seems strange
« Reply #5 on: July 29, 2012, 09:30:08 am »
Yes, i prefer .bones too.

And i have sent the files to you, thanks!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Animation seems strange
« Reply #6 on: July 29, 2012, 07:06:17 pm »
yes, there is definetely a flaw there. jME shows it correct to. I will investigate it in detail.

can you please provide me some screenshots of your skeleton, just the one below, from a similar perspective

edit: I need the screenshots in bind pose

« Last Edit: July 29, 2012, 07:18:53 pm by raft »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Animation seems strange
« Reply #7 on: July 29, 2012, 07:16:08 pm »
..and looking at your skeleton hierarchy, there are two root bones (without a parent): joint1 and joint5. This is uncommon, mostly there is only one root bone (without a parent) I think this may be causing the problem. Reorganize your skeleton that there is only one root bone and see if that helps.

I agree that Bones should handle that and I'll try to fix it.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Animation seems strange
« Reply #8 on: July 30, 2012, 12:14:28 am »
it should be fixed now, please re-download the zip

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: Animation seems strange
« Reply #9 on: July 30, 2012, 02:52:47 pm »
It works! ;D Thank you very much!