Hey guys, I'm hoping someone can help me with this problem. It's probably very simple but I've spent hours now trying to figure it out.. Let me try to describe the gist of it.
I have a ball that's being thrown up in the air, starting from y = 0, i.e. groundlevel. To move it, I subtract an yvel value of for instance 5, so it moves up by 5 pixels each frame. I know that it will move for 100 frames, thus leaving it at -500 y if it just goes at it.
But I want it to fall down, thus I add a gravity value to the yvel each loop. The gravity could for instance be -0.1. So when it runs now, the ball goes up, reaches an yvel of 0 at some point, and then goes negative, causing it to fall, and landing (well, passing the ground) at an unknown point in time.
Now, what I want to do, is calculate how much gravity it would take for the ball to be thrown up at an initial yvel of 5 (or anything else), and then be at the ground coordinate (y=0) at the exact last frame, frame 100.
It boggles me! Never had any sort of trig, and I'm pretty numbers-blind so to speak unfortunately.. I'd appreciate it if anyone could throw me a bone, maybe even explain it thoroughly so I can it through my thick skull :)
I have a ball that's being thrown up in the air, starting from y = 0, i.e. groundlevel. To move it, I subtract an yvel value of for instance 5, so it moves up by 5 pixels each frame. I know that it will move for 100 frames, thus leaving it at -500 y if it just goes at it.
But I want it to fall down, thus I add a gravity value to the yvel each loop. The gravity could for instance be -0.1. So when it runs now, the ball goes up, reaches an yvel of 0 at some point, and then goes negative, causing it to fall, and landing (well, passing the ground) at an unknown point in time.
Now, what I want to do, is calculate how much gravity it would take for the ball to be thrown up at an initial yvel of 5 (or anything else), and then be at the ground coordinate (y=0) at the exact last frame, frame 100.
It boggles me! Never had any sort of trig, and I'm pretty numbers-blind so to speak unfortunately.. I'd appreciate it if anyone could throw me a bone, maybe even explain it thoroughly so I can it through my thick skull :)