Hi everyone… again XD
Thank you so much guys for helping me so far with all my nitpicky little problems. I'm learning a great deal Maybe i'll be helping on the boards instead of constantly asking questions one day
Well… I ran into a funny little problem. I translated the bones (that are skinned to a mesh) very noticebly and tested it without the animation, and the bones moved to the specified locations fine. But now… when i call my animate method which assigns controllers to the bones and moves them accordingly… The bone-moving i done magically disappeared O_o…
Sorry for the long code:
Quaternion[] rotations = new Quaternion[6];
Vector3f[] translations = new Vector3f[6];
System.out.println("I'M WALKING I'M WALKING");
Vector3f axis = new Vector3f(0,0,1);
rotations[0] = new Quaternion();
rotations[0].fromAngleAxis(0, axis);
rotations[1] = new Quaternion();
rotations[1].fromAngleAxis(100, axis);
rotations[2] = new Quaternion();
rotations[2].fromAngleAxis(0, axis);
rotations[3] = new Quaternion();
rotations[3].fromAngleAxis(-100, axis);
rotations[4] = new Quaternion();
rotations[4].fromAngleAxis(0, axis);
rotations[5] = new Quaternion();
rotations[5].fromAngleAxis(1, axis);
translations[0] = editV3f(THIGH,0,0,0);
translations[1] = editV3f(THIGH,0,0.3f,0);
translations[2] = editV3f(THIGH,0,0,0);
translations[3] = editV3f(THIGH,0,-0.3f,0);
translations[4] = editV3f(THIGH,0,0,0);
translations[5] = editV3f(THIGH,0,.00001f,0);
BoneTransform bt = new BoneTransform();
bt.setBone(getBones().get(THIGH));
bt.setRotations(rotations);
bt.setTranslations(translations);
rotations[0] = new Quaternion();
rotations[0].fromAngleAxis(0, axis);
rotations[1] = new Quaternion();
rotations[1].fromAngleAxis(150, axis);
rotations[2] = new Quaternion();
rotations[2].fromAngleAxis(100, axis);
rotations[3] = new Quaternion();
rotations[3].fromAngleAxis(50, axis);
rotations[4] = new Quaternion();
rotations[4].fromAngleAxis(0, axis);
rotations[5] = new Quaternion();
rotations[5].fromAngleAxis(1, axis);
translations[0] = editV3f(KNEE,0,0,0);
translations[1] = editV3f(KNEE,0,0.3f,0);
translations[2] = editV3f(KNEE,0,0,0);
translations[3] = editV3f(KNEE,0,-0.3f,0);
translations[4] = editV3f(KNEE,0,0,0);
translations[5] = editV3f(KNEE,0,.00001f,0);
BoneTransform bt2 = new BoneTransform();
bt2.setBone(getBones().get(KNEE));
bt2.setRotations(rotations);
bt2.setTranslations(translations);
rotations[0] = new Quaternion();
rotations[0].fromAngleAxis(0, axis);
rotations[1] = new Quaternion();
rotations[1].fromAngleAxis(100, axis);
rotations[2] = new Quaternion();
rotations[2].fromAngleAxis(0, axis);
rotations[3] = new Quaternion();
rotations[3].fromAngleAxis(-100, axis);
rotations[4] = new Quaternion();
rotations[4].fromAngleAxis(0, axis);
rotations[5] = new Quaternion();
rotations[5].fromAngleAxis(1, axis);
translations[0] = editV3f(ANKLE,0,0,0);
translations[1] = editV3f(ANKLE,0,0.3f,0);
translations[2] = editV3f(ANKLE,0,0,0);
translations[3] = editV3f(ANKLE,0,-0.3f,0);
translations[4] = editV3f(ANKLE,0,0,0);
translations[5] = editV3f(ANKLE,0,.00001f,0);
BoneTransform bt3 = new BoneTransform();
bt3.setBone(getBones().get(ANKLE));
bt3.setRotations(rotations);
bt3.setTranslations(translations);
float[] times = new float[6];
times[0] = 0.3333f;
times[1] = 0.6333f;
times[2] = 0.9333f;
times[3] = 1.3333f;
times[4] = 1.6333f;
times[5] = 3.2f;
int[] types = new int[6];
types[0] = BoneAnimation.LINEAR;
types[1] = BoneAnimation.LINEAR;
types[2] = BoneAnimation.LINEAR;
types[3] = BoneAnimation.LINEAR;
types[4] = BoneAnimation.LINEAR;
types[5] = BoneAnimation.LINEAR;
BoneAnimation bac = new BoneAnimation();
bac.addBoneTransforms(bt2);
bac.addBoneTransforms(bt);
bac.addBoneTransforms(bt3);
bac.setTimes(times);
bac.setStartFrame(0);
bac.setEndFrame(5);
if(getNature() == LEFTSIDE_APP) bac.setCurrentFrame(4);
bac.setInterpolationRate(0.025f);
bac.setInterpolationTypes(types);
bac.setInterpolate(true);
AnimationController ac = new AnimationController();
ac.addAnimation(bac);
ac.setActiveAnimation(bac);
ac.setRepeatType(Controller.RT_WRAP);
getBones().get(THIGH).addController(ac);
ac.setActive(true);
And this is my little vertex calculating method
public Vector3f editV3f(int eff,float x, float y, float z){
Vector3f f = null;
System.out.println("src:"+getBones().get(eff).getLocalTranslation());
if(nature == RIGHTSIDE_APP)
f = new Vector3f(
getBones().get(eff).getLocalTranslation().x+x,
shiftFactor/2+getBones().get(eff).getLocalTranslation().y+y,
shiftFactor/2+getBones().get(eff).getLocalTranslation().z+z);
else if(nature == LEFTSIDE_APP){
f = new Vector3f(
getBones().get(eff).getLocalTranslation().x+x,
shiftFactor/2+getBones().get(eff).getLocalTranslation().y+y,
-shiftFactor/2+getBones().get(eff).getLocalTranslation().z+z);
}
else if(nature == BOTTOM_APP)
f = new Vector3f(
getBones().get(eff).getLocalTranslation().x+x,
getBones().get(eff).getLocalTranslation().y+y,
getBones().get(eff).getLocalTranslation().z+z);
System.out.println(f);
return f;
}
okaaay i think i may have found what the problem is… it's solving it that's an issue… I have two different animation controllers; one for the legs, the other for the torso. Whenever i attempt to move a node parent to the legs, all the changes on the legs vanish for some reason… is there any way to get around it?