I have an item obeying the laws of “projectile throw” which travels expected.
If it lands on a ramph(opposite the launch), I want it’s trajectory to change–from the former path, projectile throw, to a normal path up the ramp.
orangeBall_Vx = orange_initial_velocity * cos(orangeBallAngle);
orangeBall_Vy = orange_initial_velocity * sin(orangeBallAngle);
orangeBall_x = orangeBall_Vx * orangeBallTime;
orangeBall_y = orangeBall_Vy * orangeBallTime - (gravity*orangeBallTime*orangeBallTime/2);
if ((orangeBall_y * M + 105) < ((orangeBall_x*M - 885)*tan(rampAngle))+(orangeBallsize/2)*M) {
//would like ball path, along the y coordinates to change.
}
ellipse(c2ix(orangeBall_x*M), c2iy(orangeBall_y*M), orangeBallsize * M, orangeBallsize * M);
println("x: " + orangeBall_x*M + " y: "+ orangeBall_y*M);
if ((orangeStart == true)) {
if (orangeBallDirection) {
orangeBallTime = orangeBallTime + dt*timeFactor;
} else {
orangeBallTime = orangeBallTime - dt*timeFactor;
}
}
I would somehow like to change orangeBall_y = current location of y * sin(rampAngle);
But, no matter how I try to change it, I keep getting the full calculation of y, even though I only want it’s last known location.
it’s simple programming, but I am still learning. =)
Thanks
EDIT: added more code. There are elements that deal with the more global setup of the program, which I have left out, namely the M (scaling), and ballDirection, which I will develop further.