Author Topic: Move camera left/right on x-axis of the rotation  (Read 674 times)

Offline moyosa

  • byte
  • *
  • Posts: 9
    • View Profile
Move camera left/right on x-axis of the rotation
« on: January 15, 2015, 03:27:23 pm »
Hi,

I've got a camera and it has it's own rotation I set in the setBack. Now I want the translate let's say 10 px to the left en my camera is tilted. it does not seem to go left in the rotation x-axis but just the normal work x-axis.



So when I do a setPosition of (10,0,0). it exactly does that. But how doI translate of the rotation x-axis?



Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Move camera left/right on x-axis of the rotation
« Reply #1 on: January 15, 2015, 05:41:51 pm »
You have to translate it along the rotated x-axis instead. You can get it from your Camera instance, multiply it with the length of the translation and add the result to the current position. Either that or use the moveCamera method that takes an int constant as the first parameter.