making a bitmap arc

Post any maths and/or physics related questions here.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

making a bitmap arc

Postby WildFire » Thu Dec 16, 2004 10:15 am

Hello everyone

I need to know how do i make a ball arc such as in a volly ball game or just a ball bouncing demo. i think you all know what i mean? just for the ball to go up and the velocity of y decrease and the ball go down and the velocity of y increase but how do i actually get the ball to arc if it changes anything this is going to be written in SDL
"C++ > Mircscript" -WildFire
WildFire
 
Posts: 34
Joined: Wed Jun 23, 2004 1:56 pm

Postby r4nd0m » Thu Dec 16, 2004 9:03 pm

quadratics / projectiles.

take: h(t) = -4.905 t² + Viy t + hi

where h is height above ground in meters
t is time in seconds
Viy is the initial vertical speed in m/s
and hi is the initial height in meters.

if you want a height as a function of horizontal distance thingy [something much more useful to you] :

h(d) = (-4.905 / Vix²) d² + (Viy / Vix) d + hi

where:
h is height above ground in meters
d is horizontal distance in meters
Vix is initial horizontal velocity in m/s
Viy is initial vertical velocity in m/s
hi is height above the ground, in meters

now, for some trig:
if the person is hitting the volleyball at an angle, with a constant inital velocity, you hafta break the initial velocity into it's x and y parts:

Vix = Vi cos º
Viy = Vi sin º

where:
Vi is the initial velocity, at an angle in standard position
Vix is the initial horizontal velocity
Viy is the initial vertical velocity
º is the angle in degrees, in standard position.

Code: Select all
     /|
    / |
Vi /  |
  /   | Viy
/   _|
/º__|_|
  Vix


standard position:
ok, pretend the following addition sign is a graph, with all four quadrants
+
the prong on the right would be 0º in standard position, straight up would be 90º.

Code: Select all
    90º
180º + 0º
    270º
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, Champagne in one hand -- strawberries in the other screaming WOO HOO!
User avatar
r4nd0m
 
Posts: 1851
Joined: Tue May 11, 2004 7:43 pm
Location: Edmonton, Alberta, Canada

bitmap arcing

Postby WildFire » Fri Dec 17, 2004 9:32 am

mind saying that in english lol im not very good at this kind of thing as you may have figured out if you could explain it simpler i would really appreciate it (:
"C++ > Mircscript" -WildFire
WildFire
 
Posts: 34
Joined: Wed Jun 23, 2004 1:56 pm

Postby r4nd0m » Fri Dec 17, 2004 5:28 pm

Ok, I'll try and simplify it.

h(d) = (-4.905 / Vix²) d² + (Viy / Vix) d + hi

means that whatever horizontal distance you give the equation, it will spit out how high the object is, depending on what speeds it was going in the first place.

in flash, the code ends up being:
this._y = ((-4.905 / (Vix * Vix)) * (this._x * this._x)) + ((Viy / Vix) * x) + Hi;

so, if I were to put in that the ball's x-direction is 300, this._x would be 300. then, according to my horizontal and vertical velocity's [speeds], this._y would be the proper height of the ball [on earth].

simply, the function [at the top of this post] will tell you how high something should be when it's horizontal distance is a certain amount. Of course this depends on how fast it was initially moving.

Get it a bit better now?
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, Champagne in one hand -- strawberries in the other screaming WOO HOO!
User avatar
r4nd0m
 
Posts: 1851
Joined: Tue May 11, 2004 7:43 pm
Location: Edmonton, Alberta, Canada

sort of

Postby WildFire- » Mon Dec 20, 2004 9:38 am

that kind of makes sense but how do i use it to make a bitmap arc from for example if the x position at starting is 10, 400 how do i make it go up and then come down in a arcing motion saying that the initial X velocity is oh say 3 and the initial Y velocity is 3?
WildFire-
 


Return to Maths & Physics

Who is online

Users browsing this forum: No registered users and 0 guests