intravenous

diff src/ship.cc @ 3:94d4c60af435

some progress
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Apr 2012 03:35:18 +0300
parents 472c28b8b875
children 2723dc026c4f
line diff
     1.1 --- a/src/ship.cc	Sat Apr 21 23:03:36 2012 +0300
     1.2 +++ b/src/ship.cc	Sun Apr 22 03:35:18 2012 +0300
     1.3 @@ -11,6 +11,11 @@
     1.4  	velocity += get_direction() * a;
     1.5  }
     1.6  
     1.7 +void Ship::accelerate_side(double a)
     1.8 +{
     1.9 +	velocity += get_right() * a;
    1.10 +}
    1.11 +
    1.12  void Ship::turn(double yaw, double pitch)
    1.13  {
    1.14  	Quaternion qyaw(Vector3(0, 1, 0), yaw);
    1.15 @@ -37,6 +42,12 @@
    1.16  	return dir.transformed(rot);
    1.17  }
    1.18  
    1.19 +Vector3 Ship::get_right() const
    1.20 +{
    1.21 +	static const Vector3 dir{1, 0, 0};
    1.22 +	return dir.transformed(rot);
    1.23 +}
    1.24 +
    1.25  Matrix4x4 Ship::get_matrix() const
    1.26  {
    1.27  	Matrix3x3 rmat = rot.get_rotation_matrix().transposed();