• Advertisement
Sign in to follow this  

parametrized space launch

This topic is 4323 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);}

Share this post


Link to post
Share on other sites
Advertisement
Quote:

once is airborn, and there is 0 thrust, there is no deceleration.

Have you implemented some form of air drag or friction or some "braking" force to cause deceleration?
An object will maintain its motion until acted upon by an external force.
In the absence of forces, the spaceship will continue to move, with constant velocity and no acceleration/deceleration "ad infinitum".

Share this post


Link to post
Share on other sites
in this line
Vy=V*cos(player->phi)+(T*cos(player->theta) - Fg)*dt;

it *should* be the sum of the current velocity in the y, plus the thrust in the y minus the force of gravity

Share this post


Link to post
Share on other sites
wow, i feel like a big dum dum, but, got the problem fixed, was using km instead of m, so, was getting far enough out quickly enough to almost negate gravity.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement