# parametrized space launch

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

## 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 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 on other sites
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 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 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.

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009808
• ### Who's Online (See full list)

There are no registered users currently online

×