Members - Reputation: 366
Posted 27 August 2011 - 09:43 PM
Anyway, would anyone be as kind as to tipping me off in the right direction for figuring what the players height of jump should be based off of x-Time if button is held?
Members - Reputation: 887
Posted 28 August 2011 - 02:53 AM
acceleration = -g + other accelerations + Forces/m; velocity += acceleration*dt; position += velocity*dt;With dt being the time step. So if you want to jump you can simply modify the velocity value or add a force. Basically you do something along the lines:
if(button pressed) other accelerations = some value;You obviously still have to modify this so the player can't accelerate up by holding the jump button indefinitely.
So as long as there are no other forces and accelerations this will make the players movement approximate a parabola automatically.
Members - Reputation: 550
Posted 28 August 2011 - 05:25 AM
So, si is your position on the current frame, vi is your velocity and a is your acceleration (gravity and other forces) and t is the time. Just plug in the numbers
Members - Reputation: 266
Posted 29 August 2011 - 02:43 PM
Hey, thanks guys! I was way off on what I need to have been doing. I'll toss this in, and see if I need to do any tweaking. thanks again
You will need to do some tweaking. To the initial velocity of the jump or the acceleration due to gravity.