Hi,
I have a character who throw a ball to another one in one of my script, I want the ball to follow a parabolic way. I don't remember what is the equation for a parbolic throw?
Please, give me hints one by one, I'd like to see if I can do it by myself with your hints.
If I'm stuck, I'll ask you for other hints on this same thread.
Thanks!
Offline
Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
change x by xv
change y by yv
set yv to yv * .98
set xv to xv * .98
change yv by -1
Hope that helped!
Oh, and welcome, Snowdrop!
Last edited by firedrake969_test (2013-05-02 12:56:14)
Offline
firedrake969_test wrote:
Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
change x by xv
change y by yv
set yv to yv * .98
set xv to xv * .98
change yv by -1
Hope that helped!
Oh, and welcome, Snowdrop!
Ummm... That wouldn't follow a parabolic arch. The y velocity would eventually flatten out to 50, and would never exceed that, making this some weird equation that's not parabolic, which isn't needed here.
To PERCE-NEIGE:
Well, since your asking for the equation and not some code, here are two hints:
-b
___
2a
x^2
I hope that this helps!
With regards,
ErnieParke
Last edited by ErnieParke (2013-05-02 16:02:01)
Offline
Thank you! Just perfect.
Yes, -b/2a reminds me something! I brainstorm and I come back when I'm free.
Offline
ErnieParke wrote:
firedrake969_test wrote:
Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
change x by xv
change y by yv
set yv to yv * .98
set xv to xv * .98
change yv by -1
Hope that helped!
Oh, and welcome, Snowdrop!Ummm... That wouldn't follow a parabolic arch. The y velocity would eventually flatten out to 50, and would never exceed that, making this some weird equation that's not parabolic, which isn't needed here.
I think it's like a version with air resistance, except the formula isn't exactly right (I think the air resistance force was proportional to something like v^2, not v.
Offline
ErnieParke wrote:
firedrake969_test wrote:
Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
change x by xv
change y by yv
set yv to yv * .98
set xv to xv * .98
change yv by -1
Hope that helped!
Oh, and welcome, Snowdrop!Ummm... That wouldn't follow a parabolic arch. The y velocity would eventually flatten out to 50, and would never exceed that, making this some weird equation that's not parabolic, which isn't needed here.
To PERCE-NEIGE:
Well, since your asking for the equation and not some code, here are two hints:-b
___
2ax^2
I hope that this helps!
With regards,
ErnieParke
Actually it would...
Even if it theoretically wouldn't work, it works in practice.
EDIT: E-P, if you're reading this, it does work. I'm uploading a proof-of-concept project soon. So yes, it does work, P-N.
Last edited by Firedrake969 (2013-05-05 16:17:39)
Offline