-
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 .
-
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