Directions detect?

Started by clown611, February 09, 2017, 12:21:44 AM

Previous topic - Next topic

clown611

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?

clown611

ok I kinda solved it using ship.translate(camera.getdirection().x,camera.getdirection.y,0.04f). no idea if that is a good solution

EgonOlsen

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.

clown611

Ye it worked fine but i will try the getzaxis. Thanks