Animation change question

  1. first question
    Hi i wanted to ask why this could cause stuck overflowError

      @Override
     public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
         if(channel.getAnimationName()==null){
             channel.setAnim("Stand2hPike",0);
         }
         channel.setSpeed(0.2f);
     }
    

basically its a part of a standart animation function in animation listener .
soo some times i see my animations like … i dont know get broken ?!
its not even null , its more like and animation got stopped havt a way and may be even some what changed , soo i tried to fix it by simply do :
if null just set to standing .

  1. question :
    i try to make some sort of formation soo i do this :

    Node banner = new Node (); // banned is a model i import
     public void assignPositionInFormation(){
     int row=1;//*1 change nothing *0 would ruin it soo 1 is like 0
     bannerRotation= getBanner().getLocalRotation().getRotationColumn(2);
     leftTopCorner=getBanner().getLocalTranslation().add(
             // move to left + move top , Y is 0 couse flat 2d calculation
             bannerRotation.getZ()*(float)Math.sqrt(((float)spawnedSoldierList.size())/2)+
                     bannerRotation.getX()*(float)Math.sqrt(((float)spawnedSoldierList.size())/2),
             0,
             bannerRotation.getX()*(float)Math.sqrt((float)spawnedSoldierList.size()/2)+
                     bannerRotation.getZ()*(float)Math.sqrt(((float)spawnedSoldierList.size())/2));
     
     // for rows
     int count=0;
     for (int i = (int) Math.ceil(Math.sqrt(spawnedSoldierList.size())); i >0; i--) {
         for (int j = (int) Math.ceil(Math.sqrt(spawnedSoldierList.size())); j > 0; j--) {
             if(spawnedSoldierList.size()-1>=count){
             spawnedSoldierList.get(count).setPositionInFormation(new Vector2f (leftTopCorner.getX(),leftTopCorner.getZ()));
             // substract for next (subbstract local changes actually values in V3f
             leftTopCorner.subtractLocal(bannerRotation.getZ(), 0, bannerRotation.getX());
             count++;
             }
         }
         //each row substract one row
         // restart lenght
         leftTopCorner=getBanner().getLocalTranslation().add(
             // move to left + move top , Y is 0 couse flat 2d calculation
             bannerRotation.getZ()*(float)Math.sqrt(((float)spawnedSoldierList.size())/2)+
                     bannerRotation.getX()*(float)Math.sqrt(((float)spawnedSoldierList.size())/2),
             0,
             bannerRotation.getX()*(float)Math.sqrt((float)spawnedSoldierList.size()/2)+
                     bannerRotation.getZ()*(float)Math.sqrt(((float)spawnedSoldierList.size())/2));
         // change depth
         leftTopCorner.subtractLocal(bannerRotation.getX()*row, 0, bannerRotation.getZ()*row);
         row++;
     }
    

    }

    now problem is like i cant put them in rotating formation , lets say square

i do rotate banner by say

          getBanner().setLocalTranslation(getMyCommander().getBody().getLocalTranslation().add(0, 1, 
         0));
        getBanner().setLocalRotation(getMyCommander().getBody().getLocalRotation());

and myCommander is rotated well , i can see it .

i cant figure what ami do wrong and why its not making my formation rotating with banner
it works only on one side, but if i look in other direction soldiers just gets in one row and not square

Hi,
It’s pretty hard to understand what you want to achieve. Use the debugger for your first problem, set some breakpoints, and look at the stack trace.

For the second problem: Show us some screenshots and tell more about the problem and what you really expect from it.

Hi, here is answer.

Note: I would be able to provide 99% more of the answer if you provided 99% more of the exception information. You’ve only provided the nearly useless part and left out the 99% useful stack trace part.

Men … it is 99% of code , i use basic game build from guide as base ,and for tests …
If you just take and cube creation guide build and , use my code i wrote here , you will see all you need …
I may have some doubt’s on first question as it might be some inside model problem…
but second question is with all the code it uses … the rest is jme basic guide

please note that it would be helpfull for helpers, to already see error note. Giving them more work is demotivating. There were already people that show little part of code and just telling “it dont work”, showing no error logs. At the end error were somewhere else anyway…

Good luck with your game!