Original Post
was wondering where i made my blunder, can't figure it out. once is airborn, and there is 0 thrust, there is no deceleration.
#define THRUST 2090000//kN
#define DRYMASS 80000 //kg
#define INITFUEL 0 //kg
#define RADIUSEARTH 6378.1 //km
#define GMEARTH 3986005//x10^8 m3/s
class Spaceship{
//theta = angle from verticle to axis of ship
//phi = angle frme verticle to angle of V
//gamma = angle from top of world to space ship
public:
double theta, phi, gamma;
long double height;
double mass, drag,velocity;
float thrust_percent;
Spaceship()
{ theta=0; phi=0; gamma=0; height=0;
mass=0; drag=0;velocity=0; thrust_percent=0;
}
};
void Update_Spaceship(Spaceship *player, int delta_t)
{ long double Vx, Vy, V, T, Fg; //m/s x3 N
float dt=(float)delta_t/1000.;
V=player->velocity;
T=THRUST*(player->thrust_percent*10.)/player->mass;
Fg=GMEARTH/pow(player->height,2);
Fg=Fg*100000000;
Vx=V*sin(player->phi) + T*dt*sin(player->theta);
Vy=V*cos(player->phi)+(T*cos(player->theta) - Fg)*dt;
V=sqrt( pow(Vx,2)+pow(Vy,2));
player->velocity=V;
player->phi=atan2(Vx,Vy);
player->height+=(Vy*dt);
player->gamma+=atan2(Vx*dt,player->height);}