Author Topic: character.get(0).getTransformedCenter() Changes Gradually  (Read 950 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
character.get(0).getTransformedCenter() Changes Gradually
« on: August 07, 2013, 11:05:19 pm »
Code: [Select]
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);
     }

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: character.get(0).getTransformedCenter() Changes Gradually
« Reply #1 on: August 08, 2013, 12:27:20 am »
yes, because transformed center takes into jPCT calculated center into account. use getTranslation instead