Sign in to follow this  
BlaDe16

calculus/velocity accelaration position

Recommended Posts

Yesterday I was playing sonic and something came to me. Looking at Sonic(2) jump around and bounce off enemies I had a strong feeling that everything in his world had to do with what im learning in school and I want to know if what im seeing is in fact correct. I'll give an example of what my teacher gave in class: A tennis ball is dropped from a height of 16 feet rebounds to height of 4 feet. The formula for the height before the ball bounces is s(t)=16-16t^2 and after it bounces the first the the formula for the height is s(t)=v(sub0)(t-1)-16(t-1)^2, where v(sub0) is the initial velocity after the first bounce. Compute v(sub0) and the time it takes when the ball will bounce again. Compute the velocity before the ball bounces the first time and after it bounces the secpmd time. Is the velocity a continuous function of time? I am trying to imagine rather than a tennis ball its sonic:), maybe I should have asked this in the math section, im sorry if its the wrong section. Does anyone know where the formula 16-16t^2 and the formula of the height above comes from. Meaning is there an actual english definition of what it is and why it was why/how it was derived? Thanks!!

Share this post


Link to post
Share on other sites
x = distance traveled
v = velocity
a = acceleration.

now, assuming acceleration is constant, then a = v(t) - v(t+dt);
and using calculus we can instead define v(t) = at + v(0); by integration
then we can define position as x(t) = .5att + v(0)t + x(0); by integration

various arrangements of this formula (assuming different things are constant and know) give you the basic 5 equations of motion: wiki

Share this post


Link to post
Share on other sites
Quote:
Original post by BlaDe16
Looking at Sonic(2) jump around and bounce off enemies I had a strong feeling that everything in his world had to do with what im learning in school and I want to know if what im seeing is in fact correct.

You're correct in that it has to do with what you're learning in school, and you'll understand it more when you later get to learn about derivatives and integrals, maybe that'll be in a couple of years.

In many game- or physics engines a ball object moves in many small steps, instead of along a function that describes an arc. The movement during each step can be calculated with a function like you describe, but not exactly the example (that's a special case for 16 feet).

If the game is running at 60 frames per second, it'll calculate the movement separately in 60 steps per second.

Each step, the ball center will be moved slightly, by adding velocity multiplied by the time of the step (and by adding acceleration too, but it's multiplied by time2 / 2). And the time of the step is 1 / 60 seconds. Also, the ball velocity will be changed slightly, by adding acceleration multiplied by the time of the step. And the acceleration is the gravity.

Quote:
Original post by BlaDe16
Does anyone know where the formula 16-16t^2 and the formula of the height above comes from. Meaning is there an actual english definition of what it is and why it was why/how it was derived? Thanks!!

That formula is an example, where the first "16" is the height in feet that the ball is at when the time is 0, t = 0.

The second "16" seems to be there because it's easy to calculate by hand, so it's not entirely realistic physics (on our earth), but the ball will accelerate.

Share this post


Link to post
Share on other sites
thanks for the response. I am actually learning derivatives right now so I am unsure how they play a part in a game other than that the derivative of s(t) = v(t) = accelaration(t), but im pretty new to this and since its college calculus 1 I wouldn't be shocked to learn intergrals however how much of it I don't know.

Share this post


Link to post
Share on other sites
Quote:
Original post by megaxx099
I read this and almost cried. that stuff looks impossible. sigh. i'll need to complete calculus to get my computer sciences degree *sob*


I'm sorry to have to tell you this, but you'll need to complete calculus to get almost any degree not in the "liberal arts".

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
Quote:
Original post by megaxx099
I read this and almost cried. that stuff looks impossible. sigh. i'll need to complete calculus to get my computer sciences degree *sob*


I'm sorry to have to tell you this, but you'll need to complete calculus to get almost any degree not in the "liberal arts".


Not in this country you don't [grin].

I'm saving this thread for later, the physics looks like it'll be useful for a project I've got in the back of my mind.

Share this post


Link to post
Share on other sites
Quote:
Original post by ukdeveloper
Quote:
Original post by Zahlman
Quote:
Original post by megaxx099
I read this and almost cried. that stuff looks impossible. sigh. i'll need to complete calculus to get my computer sciences degree *sob*


I'm sorry to have to tell you this, but you'll need to complete calculus to get almost any degree not in the "liberal arts".


Not in this country you don't [grin].

I'm saving this thread for later, the physics looks like it'll be useful for a project I've got in the back of my mind.


im sorry to read what u had to tell me zahlman. and damn u ukdeveloper and your schools and all :). Now if I could just stop yelling at ppl online long enough (seriously) to go get a book and start improving my math skills. so is calc just like a hodgepodge of algebra geometry physics and trig all in one. which one would u use more of? my algebra is good. physics ok. geometry bad. trig awful. dropped trig halfway thru in high school to prevent failing. but from the question and equations in the thread... im assuming I won't like the answer.

Share this post


Link to post
Share on other sites
Calculus is not math like others such as algebra - it deals with rates of change and trends (limits). You won't need to understand trigonometry to understand basic calculus. However, trigonometry is absolutely essential to any kind of physics or engineering work - you will need to learn this if you want to work on physics in games.

You cannot possibly form a true understanding of physics without an understanding of (at least basic) calculus.

Share this post


Link to post
Share on other sites
Speaking of Physics (Introductory Mechanics, Heat, and Sound) and Calculus, I'm doing both in college right now, and it opened up a whole new ball game for me, in terms of physics in games, I'm loving the two classes. You learn a lot.

Share this post


Link to post
Share on other sites

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