Sign in to follow this  

gradual acceleration and deacceleration

This topic is 2848 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

Hello everyone i am currently working on a 2d project... my object falls from a particular height then the speed gradually accelerates then on key press the parachute opens and the object starts to de-accelerate upto a point and then keep falling again with a continuos speed... i have been able to achieve the acceleration and deacceleration with my function which returns me the distance int CalculateSpeed (float speed, float time ) { time += 0.1; dist = dist + (speed * time); return dist; } the problem i am facing is that after deaccelerating to a point i am not able to get the object falling with a continous speed.... please can anyone suggest some solution or a better/different way of doing it... any advice would be of great help... Thanks Anup Gupta

Share this post


Link to post
Share on other sites
Here's something somewhere in-between real C/C++ code and pseudocode:


struct particleState
{
vector2d pos;
vector2d vel;
};

//...

particleState nextState(particleState x, bool parachuteOpen, double dt)
// Given the current state x, the timestep dt, and whether the parachute
// is open, returns the next state.
{
particleState x2; // This will store our return value

double a;
if(parachuteOpen)
a = mu*square(x.vel) - g; // g,mu constants
else
a = -g;

// Take a symplectic Euler step
x2.vel = x.vel + Vector2d(0, a*dt);
x2.pos = x.pos + x2.vel*dt;

return x2;
}



To find terminal velocity with parachute open, solve

a = mu*square(x.vel) - g = 0

for x.vel. You get that the terminal velocity will be sqrt(g/mu). So pick mu accordingly.

[Edited by - Emergent on February 25, 2010 12:43:14 PM]

Share this post


Link to post
Share on other sites
hello Emergent

I just want to say thank you a million times...

I just got the parachute acceleration , deacceleration and continuous falling after deacceleration in perfect sync..just as i wanted...

thanks for your pseudocode it worked like a charm...

Regards

Share this post


Link to post
Share on other sites

This topic is 2848 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this