Bug in AnimControl (6 posts)

Topic tags: animation, animControl, bug, com.jme3.animation, setAnimations
  • Profile picture of jnewman30 jnewman301p said 4 months, 3 weeks ago:

    It seems you must initialize the animation HashMap manually or you get a null pointer exception at runtime. This appears to be a bug. Can someone confirm… Example code below…

    private AnimControl generateGemAnimation(Geometry target) {
    	AnimationHelper animationHelper = new AnimationHelper(1, "selectAnim");
    	animationHelper.addTimeScale(0, target.getLocalScale());
    	animationHelper.addTimeTranslation(0, target.getLocalTranslation());
    	animationHelper.addTimeRotation(0, Quaternion.IDENTITY);
    	animationHelper.addTimeRotation(0.5f, new Quaternion()
    			.fromAngleNormalAxis(FastMath.PI, Vector3f.UNIT_Y));
    	animationHelper.addTimeRotation(1f, new Quaternion()
    			.fromAngleNormalAxis(FastMath.TWO_PI, Vector3f.UNIT_Y));
    
    	Animation anim = animationHelper.buildAnimation();
    	AnimControl control = new AnimControl();
    	control.setAnimations(new HashMap<String, Animation>()); // remove this line and throws exception on next line...
    	control.addAnim(anim);
    	AnimChannel channel = control.createChannel();
    	channel.setLoopMode(LoopMode.Loop);
    	channel.setAnim("selectAnim");
    
    	return control;
    }
    
  • Profile picture of sbook sbook255p said 4 months, 3 weeks ago:

    I think this is intentional, as the Javadoc at one point mentioned that you had to call setAnimations in order for the class to be useful but it seems that bit of documentation is gone.. @Momoko_Fan?

    Oh, and welcome to the forum… thanks for the quality first post! :)

  • Profile picture of nehon nehon590p said 4 months, 3 weeks ago:

    that’s strange i committed a fix to that when I committed the AnimationHelper….
    Are you using nightly? are you using source code from svn? if it’s the latter make sure you updated the whole project.

    Also AnimationHelper is a bit fresh, so there might be some issues yet.

  • Profile picture of jnewman30 jnewman301p said 4 months, 3 weeks ago:

    Ahh… I pulled the beta release and then noticed AnimationHelper later on and “kyped” the code by itself… Thanks for the greetings and GOOD WORK! btw… Very cool stuff.

  • Profile picture of jnewman30 jnewman301p said 4 months, 1 week ago:

    Works quite well so far. Definitely a big help to me.

  • Profile picture of nehon nehon590p said 4 months, 1 week ago:

    Cool thanks for your feed back.
    BTW it has been renamed to AnimationFactory in the last SVN