Re: [Algorithms] cannon physics
Brought to you by:
vexxed72
From: Ben S. <3d...@ar...> - 2003-12-12 18:13:51
|
You know, im not really sure. What is first order time stepping? Heres what I do. Use Lance's formula to calculate velocity and angle. Then I create a vector from the values using: XVelocity = Velocity*cosf(Angle) YVelocity = -Velocity*sinf(Angle) Then I do a loop where I step time (is this the same thing your talking about?) For Time = 0 to 20 (seconds) Time += 0.5 MyPoint.x = StartPos.x + XVelocity*Time MyPoint.y = StartPos.y + YVelocity*Time+(Gravity*Time^2)/2.0 Next I continue until either all 20 seconds is used up (never) or until MyPoint.y is lower than my target (on its way down). Thanks. -=ben ----- Original Message ----- From: "Jonathan Henckel" <jhe...@cs...> To: <gda...@li...> Sent: Friday, December 12, 2003 9:09 AM Subject: RE: [Algorithms] cannon physics > > > -----Original Message----- > > From: Ben Siroshton [mailto:3d...@ar...] > > Sent: Thursday, 11 December, 2003 6:22 PM > > To: gda...@li... > > Subject: Re: [Algorithms] cannon physics > > > > > > Bob, Lance, > > > > Thanks for your help. I did manage to get it working, > > however now I am > > realizing that I can not fix the height as it doesnt allow me > > to always hit > > my target. > > Can you be more specific? It looks to me like Lance's formulas will work > for all inputs, h>y and h>=ty. Perhaps your cannon misses because you are > using first order time-stepping? > > John Henckel > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 |