Hi!
I’m working on a game where you drive the spaceship in free space. I’m still learning how to control objects in 3D. So far I have made a spaceship that you can control/drive with keyboard. I would like to add some physics like acceleration and friction and I got stuck in one point. Right now I use this code to move ship:
if (_key.isDown(68)) _ship.moveBackward(10);
if (_key.isDown(83)) _ship.moveForward(10);
if (_key.isDown(38)) _ship.rotationX -= _vx;
if (_key.isDown(40)) _ship.rotationX += _vx;
if (_key.isDown(37)) _ship.rotationY -= _vy;
if (_key.isDown(39)) _ship.rotationY += _vy;
Since i want to add some physics I would like to move it so looks like this:
if (_key.isDown(68)) _ship.moveBackward += 10;
if (_key.isDown(83)) _ship.moveForward += 10;
So, the move method is problematic.
How can i do that using some other function or method?
I have try to use _ship.z += 10 but this does just z translation not moving back and forward because i also use _ship.rotationX and Y.
Thanks!
Vedran