Combination "md5" and "FengGUI"

Hi,



i stumbled over a problem which i wasn't able to solve. Here's the problem:

I tried to intergrate FengGUI (the standard FengJME example class from the tutorial) into the md5 importer classes. In other words: i wanted to have an animated md5.mesh with 2D GUI Elements ontop. Everything worked out fine except the fact that the md5.anim files do not work. I can see and interact with the GUI and also the md5 model is loaded and displayed correctly. BUT the model is not moving. There isn't any exception and the animation seems to load perfectly but it is not started. Of course without the FengGUI the models animation is started perfectly. Here's the complete code, because I'm not sure where the problematic parts could be. And sorry for some German comments  :D   



import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import md5reader.MD5AnimReader;
import md5reader.MD5MeshReader;
import model.Model;
import model.SkeletalModelInstance;
import model.animation.Animation;
import model.animation.AnimationAnimator;
import model.animation.AnimationController;

import org.fenggui.ComboBox;
import org.fenggui.TextEditor;
import org.fenggui.composites.Window;
import org.fenggui.event.ISelectionChangedListener;
import org.fenggui.event.SelectionChangedEvent;
import org.fenggui.layout.StaticLayout;
 
import com.jme.app.BaseGame;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.MouseInput;
import com.jme.light.PointLight;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.scene.state.LightState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.Timer;
import com.jme.util.lwjgl.LWJGLTimer;
 
/**
 * FengJME - A test class for integrating FengGUI and jME.
 *
 * @author Josh (updated by neebie)
 *
 */
public class FengJME extends BaseGame
{
   Camera cam; // Camera for jME
   Node rootNode; // The root node for the jME scene
   PointLight light; // Changeable light
   FengJMEInputHandler input;
   Timer timer;
 
   Box box; // A box
 
   org.fenggui.Display disp; // FengGUI's display
   
   //Vectoren f

I know it's a lot of code, but most stuff is from the tutorials and should look familiar to you.

Can anybody help, I need a working solution and don't know where to look for the bug.

Has anybody a running solution with a combination of FengGUI and md5 models and anims??? Please post the code!!!

Thanks a lot!!



MiKe

Well, I think I figured it out by myself. The problem was a missing



interpolation = timer.getTimePerFrame();

bodyInstance.updateGeometricState(interpolation, false);



in the update()- method.

Now it's working fine.

Strange that nobody could help me with this obvious bug. I hope next time I encounter a problem you guys are a little bit more helpful :wink:

Would like that.



MiKe

Sorry Mike, sometimes posts fall through the cracks…  :expressionless:

We gave you the best help anyone could ask for;  we helped you to help yourself!  :wink:

Well, thanks for helping me to help myself,… BUT  :smiley: there seems to be another problem in my project:



There are some animations that make my model shake around.

For example:



If I load a *.md5model the model is displayed perfectly. In the *.md5anim file is a simple walkcycle for my character. After adding the

animation to the model the walkcycle is starting as planed. But in addition to the walkcycle the model itself is shaking around for a few pixels.

What the hell is that all about???



Thanks for help!

MiKe

Sounds like the same problem as here:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=4709.0



Looks like you’ll have to wait for mcbeth to investigate.

Yea, I stumbled over that thread two seconds ago :wink:



Ok, here's another question, but this time it's more semantic than syntactic:



What is the best structure for using md5models in combination with changing animations (method: fadeToAnimation() )


  • One Model with one AnimationController and many Animations (to switch between them if necessary)
  • One Model with many AnimationControllers which have only one specific Animation (in that case i would have to switch controllers)



    I only figured out the first option, but what would you prefer??

    Problem in the first case is, that if I create a new animation, I have to add it to a controller at the same time. And doing this results in a weird animation-mix of all added animations. So I coded:



    //////ANIMATION

            //Add Animation tp the controller

            AnimationAnimator anim = animationController.addAnimation( bodyAnimation1 );

            anim.setInterpolationThreshold( 0f );

            //Create a second animation for a later animation-fading

            anim2 = animationController.addAnimation( bodyAnimation2 );

            animationController.removeAnimator(0);  // Prevents the animation-mix between anim1 and 2

    ///////////////





    Sorry to bother you once again, but it seems that there isn't any useful api or help files I could use instead.

    I'm currently analyzing this engine, and there is a pretty good chance we are using this engine in our company for future projects, if everything turns out fine.



    So thanks fpr support :slight_smile:

    Any code-examples are welcome!!



     








as I said that post in the other thread I am not getting that jitter my cvs though is more than six weeks old, perhaps I am not seeing it, but from you guys say that jitter is not exactly subtle so I doubt that i miss it. at any rate that loader uses very little of jme itself trimesh/buffer utilities/ and the math classes if I remember correctly,



as for the the weird mixing it is trying to blend the animations the problem is that while the md5 format mechanisms for labeling animated from non amimated component's export scripts for blender and max "that are written by derton" doesn't cater for this, added to that it would seem that blending is the default behavior.



I'm however not the greatest coder…can only learn as time/life allows…which isn't muich, so I could be wrong on some front