www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: fireside on February 21, 2008, 06:03:18 pm

Title: animation problem
Post by: fireside on February 21, 2008, 06:03:18 pm
I've just used a walk and stand animaton with sub sequences up till now and everything was working fine.  However I set up a jump, where the characters size is quite a bit different.  He's scrunched down now getting ready to leap.  Jpct makes garbage out of the model.  If I set the default model that loads at the start as the jump model, then it looks all right, but the stand and walk animations turn into garbage.

edit:  I might get that worked out by using more gradual changes, I'm not sure.  But I'm also getting an error for too many key frames defined when I get to the sixth one with this code:

Code: [Select]
    Mouse = loadModel("data/stand.3ds",1); 
// Object3D Mouse;
  Mouse.translate(0, -5, 0);
 // Mouse.createTriangleStrips();
TextureManager tm = TextureManager.getInstance();
    Texture tex=new Texture("data/fur.jpg");
    tm.addTexture("fur", tex);    
    tex = new Texture("data/red.jpg"); 
    tm.addTexture("red", tex);    
    Mouse.setTexture("fur");
world.addObject(Mouse);
  Animation mouse = new Animation(5);
  mouse.createSubSequence("walk");

  mouse.addKeyFrame(loadModel("data/walk2.3ds",1).getMesh());
  mouse.addKeyFrame(loadModel("data/walk3.3ds",1).getMesh());
  mouse.addKeyFrame(loadModel("data/walk4.3ds",1).getMesh());
  mouse.addKeyFrame(loadModel("data/walk1.3ds",1).getMesh());
  mouse.createSubSequence("stand");
  mouse.addKeyFrame(loadModel("data/jump.3ds",1).getMesh());
  mouse.addKeyFrame(loadModel("data/jump2.3ds",1).getMesh());

The last key frame gives me that error.  Doesn't seem like very many.  I was planning on using quite a few more animations.
OH  DUH!!!  I forgot I defined the animation size.  I'll get back on if the more gradual animations helped.
Title: Re: animation problem
Post by: EgonOlsen on February 21, 2008, 07:02:16 pm
If keyframes are too different, the results will look very strange. That's only natural, because you can't interpolate _ to | without at least some inbetween frames and expect it to look good. Also make sure that your vertices match, i.e. what is vertex x in frame a has to be vertex x in frame b, or otherwise, hell breaks loose... ;D
Title: Re: animation problem
Post by: fireside on February 21, 2008, 07:15:50 pm
Yeah, it's working better with an extra frame in the jump.