I\m writing an endless runner. The following camera code produces gradually further results relative to the character. The character, of course, is animated. so is it possible that the animation causes a shift in its transformed center?
private void follow() { //ADJUSTS CAMERA
Matrix matrix = character.get(0).getWorldTransformation().invert3x3();
camera.setBack(matrix);
camera.setPosition(character.get(0).getTransformedCenter());
camera.rotateCameraY((float)Math.toRadians(180+cameraDisplacement));
if (character.walkUp) {
camera.rotateCameraX((float)Math.toRadians(-65));
camera.moveCamera(Camera.CAMERA_MOVEOUT, 160f);
}
else camera.moveCamera(Camera.CAMERA_MOVEOUT, 240f);
}
yes, because transformed center takes into jPCT calculated center into account. use getTranslation instead