Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gravity

Status
Not open for further replies.

peter11

Instructor
Mar 16, 2001
334
0
0
US
I am trying to create gravity for a flight of a ball. The code i am using causes the ball to travel in a more triangular pattern as opposed to a arc. I am trying my best to follow the laws of gravity (for a crossover lesson with physics).

g is a constant value -- 9.8
Code:
    conv = Val(hsbAngle.Value) / 180 * 3.141592654
    shpBall.Left = shpBall.Left + Vel * Cos(conv)
    
        
    If blnDown = False Then
        Vel = Vel - g
        shpBall.Top = (shpBall.Top - ((Vel) * Sin(conv)))
    Else
        Vel = Vel + g
        shpBall.Top = (shpBall.Top + ((Vel) * Sin(conv)))
    End If
    
    If Vel <= 0 Then blnDown = True
 
>> g is a constant value -- 9.8

Only on the earth. [wink]

Is this a homework assignment?

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Actually I am using .5. I am just trying to keep it close to a physics formula.
 


Mr. Instructor,

It seems to me that you have equated velocity with force.

What gives?

Skip,
[sub]
[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue][/sub]
 
Not sure what you mean F=m*a, there is no mass.

I tried to decrease velocity by .5 until gravity = 0
Once it equals 0 the ball should begin to fall. At that point i am increasing velocity by .5.
 


How can distance/time be equal to distance/time squared?

Skip,
[sub]
[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue][/sub]
 


Sorry, I meant acceleration rather then force -- no mass.

Skip,
[sub]
[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue][/sub]
 
Bare with me, it has been a while since I studied physics. The top value of the ball is increasing by velocity every loop and velocity is decreasing by .5 every loop, at some point velocity (for upward motion will equal 0 which means the ball should begin to fall).
Is this concept correct?

Meanwhile the left property of the ball is increasing by velocity unhindered until it hits the ground.

Should these two factors create a ball moving in an arc?

 


Why would the velocity be decreasing/increasing by a CONSTANT VALUE.

That's not how gravity works, is it?

velocity - meters per second
gravity - meters per second per second

Skip,
[sub]
[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue][/sub]
 
Should be a parabola. In a vacuum anyway.
You aren't using the right equations for the motion of a particle, so you won't get the right result. Where does the .5 come from?
Skipvought, I love your sig
 
Maybe take the arc out for debugging gravity... Ignorning air friction, imagine you ball goes straight up and then falls straight down.

It is moving up at some rate of X meters/ second...

It is accellerating down at 9.8 meters/(seconds * seconds)

So when the ball is first launched its up vector is longer than its down vector:[tt]
Up: -------->
Down: <--
Net: ----->
[/tt]


As the time increases, so does the down vector:[tt]
Up: -------->
Down: <-----
Net: -->
[/tt]

Eventually the ball stops going up: (apex)[tt]
Up: -------->
Down: <--------
Net: 0
[/tt]


Now the ball is heading down:[tt]
Up: -------->
Down: <-----------
Net: <--
[/tt]


Falling faster:[tt]
Up: -------->
Down: <-----------------
Net: <--------
[/tt]


Hits the ground (ignore bounce):[tt]
Up: 0
Down: 0
Net: 0
[/tt]
 


You might mean that you want .5 second intervals to evaluate the position of the object.

It would seem that the time interval would be the only thing that might be constant other than the acceleration due to gravity.

Skip,
[sub]
[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue][/sub]
 
Velocity needs to be resolved int Horizontal and vertical vectors / components. Vertical component is affected by g. HJorizontal component is not affected by g. (but MAY be affected by intersection with other object(s)). blndown is not useful / relevant. V(Vertical) is always decreasing by g (at least until affected by object intersection with another object. it the other object is the 'earth' (or floor or other terminiating onbject, then v(vertical) gfoes to zero (0) and hte energy involove in v(vertical) is transfered to the new object. MAY variations on the theme exist, as the object may exhibit elasticity, the object(s) hit (vertical OR horizontal) may cause other changes to the total velocity vector, necesssitating a new resoloution into vertical and horizontal velocities at any time stem.






MichaelRed


 
... and the launch angle will tell you which part of the rate goes into the horizontal vector and the rest into vertical.
 

Thanx, Michael, it's coming back to me now after some 40 years since freshman physics.

The initial angle and velocity determines the horizontal and vertical components of velocity. Horizontal, constant: vertical affected by gravity v = gt

Skip,
[sub]
[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue][/sub]
 
I have to run to a meeting but I would love to pick up with this discussion on Monday. The v- gt actually helps I just need to figure what to make t. It has to be a constant value, right!? Since we are not really working in meters or seconds,I guess i can just make up that value.

Thanks, I will be back on monday.
 
Took me about 2 minutes in Excel to code a small table for x & y and plot in a chart, given...
[tt]
g -9.8 [sub]m/s/s[/sub]
t 5 [sub]sec[/sub]
v 1000 [sub]m/s[/sub]
a 45[sup]o[/sup]
[/tt]

Skip,
[sub]
[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue][/sub]
 



Code:
With [b]wu[/b]
  I guess that Mr. Instructor [b].z .ce[/b] a kid.
End With

Skip,
[sub]
[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top