Author Topic: Directions detect?  (Read 2136 times)

Offline clown611

  • byte
  • *
  • Posts: 34
    • View Profile
Directions detect?
« on: February 09, 2017, 12:21:44 am »
Hi again. Im making a game with a spaceship that moves around in space. I controll my spaceship with translate, but when I rotate my ship towards another direction ofc the translate movement doesnt apply on my spaceship. How do you handle this? Is there a way to detect directions or should I make my own method depending on how much I have rotated?

Offline clown611

  • byte
  • *
  • Posts: 34
    • View Profile
Re: Directions detect?
« Reply #1 on: February 09, 2017, 01:32:22 am »
ok I kinda solved it using ship.translate(camera.getdirection().x,camera.getdirection.y,0.04f). no idea if that is a good solution

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Directions detect?
« Reply #2 on: February 09, 2017, 08:28:35 am »
It depends. It should be fine as long as the camera and the ship are in sync. If not, it might be better to simply use getZAxis() on the ship for the translation.

Offline clown611

  • byte
  • *
  • Posts: 34
    • View Profile
Re: Directions detect?
« Reply #3 on: February 09, 2017, 11:37:54 am »
Ye it worked fine but i will try the getzaxis. Thanks