# Box sliding down multiple ramps

#### clamport

Hey all,
I was wondering about a box that is sliding down what is basically a half pipe. There are 3 ramps, and I can get the correct sliding on the first ramp, but I can't figure out how to make it move to the next ramp. I am posting my physics code if anyone is interested...
Code:
        public override void Update(GameTime gameTime)
{
Console.WriteLine("-- In Physics.Update() Theta is " + theta);
double Fnet_Magnitude = Net_Force();
Vector3 Fnet = new Vector3();

if (theta > 0)
{// Downhill left side
Console.WriteLine("Theta is greater than zero");
Fnet.X = (float)(-Fnet_Magnitude * Math.Cos(           theta   ) );
Fnet.Y = (float)(-Fnet_Magnitude * Math.Sin( Math.Abs( theta ) ) );
}
else if (theta < 0)
{// Uphill right
Console.WriteLine("Theta is less than zero");
Fnet.X = (float)( Fnet_Magnitude * Math.Cos(           theta   ) );
Fnet.Y = (float)(-Fnet_Magnitude * Math.Sin( Math.Abs( theta ) ) );
}
else
{
Console.WriteLine("-In else statement");
}
Euler_Update(Fnet);

// So... notes
// Next X
// X(i+1) = X(i) + delta(t)*Vx
//
// Next Y
// Y(i+1) = Y(i) + delta(t)*Vy
//
// Vx(i+1) = Vx(i+1) + delta(t)(Fx/m)
//
// Vy(i+1) = Vy(i+1) + delta(t)(Fy/m)

base.Update(gameTime);
}

private void Euler_Update( Vector3 Fnet_Force )
{
//previous_position = position;
//previous_velocity = velocity;

position = position + timestep * velocity;
velocity = velocity + timestep * ( Fnet_Force / (float)mass );
}

private bool Sliding()
{
//return (__mu_static > __mu_dynamic);
return true;
}

// Ft is tangential force
// Fn is normal force
// Fg is gravitational force
private double Net_Force()
{
double Fn = mass * gravity * Math.Cos(           theta   );
double Ft = mass * gravity * Math.Sin( Math.Abs( theta ) );

//double mu = (Sliding()) ? mu_dynamic : mu_static;
double mu = mu_dynamic;

return Ft - mu * Fn;
}
Now, for some reason when I update theta the box continues to slide down the previous ramp. So my question is, how do I take that previous velocity and apply it to the new ramp?

Sorry about my confusing topic, I am not a very good math guy...
Thanks!
Chris

#### fresh_42

Mentor
2018 Award
You simply have to set up the equations of motion with a starting velocity, which is a constant additive term.

"Box sliding down multiple ramps"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving