I basically want to move the horse based upon user input, and have the camera follow the horse. moveVec.y will always be 0 so that the horse will always move in the x-z plane. The problem is that the horse moves, but the camera doesn't follow it. The camera just sits at its initial position. Heres the code:
horse.translate(moveVec);
horse.translateMesh();
SimpleVector horsePos = horse.getTransformedCenter();
horsePos.add(horse.getTranslation());
cam.setPosition(horsePos);
//want cam up to match horse up
SimpleVector up = horse.getYAxis();
up.y *= -1;
//horse is facing along x axis
SimpleVector dir = horse.getXAxis();
cam.setOrientation(dir, up);
//move back according to zoom input
cam.moveCamera(Camera.CAMERA_MOVEOUT, currentZoom);
//move up, but move up less if looking up
cam.moveCamera(Camera.CAMERA_MOVEUP, (currentZoom - lookUp) * .5f);
SimpleVector look = horse.getXAxis();
//look at position ahead of horse
look.scalarMul(currentZoom * 2f);
//look at position above horse if user input indicated to do so
look.y -= lookUp;
cam.lookAt(look);
horse.clearTranslation();
I'm assuming I'm doing the translation wrong in some way, but have no idea how, or what else it could be.
Thanks in advance
/lance