It's for a math final.
Quote from: TheCrazedGuy on May 22, 2017, 11:20 PM
It's for a math final.
yes
http://worms2d.info/User:Etho/Physics_Engine
Thx Btw here's my youtube https://www.youtube.com/channel/UCj4g0_bcjjDmKsSd5P996Xw my treat.
This is what i've always related bng to: https://en.m.wikipedia.org/wiki/Projectile_motion (https://en.m.wikipedia.org/wiki/Projectile_motion)
Physics is cool! :)
Yeah the curve of a thrown grenade would be an obvious thing to describe using maths. This is fairly simple because the nade is only accelerated by the vertical force of gravity.
If you're familiar with vector functions you can describe the path of a bazooka projectile which is also accelerated horizontally by the wind.
A zook function would look something like this
f(t):
x(t) = v0x * t + 0.5 * w * t^2
y(t) = v0y * t - 0.5 * g * t^2
( v0x , v0y ) is the initial velocity vector. This vector describes the angle and power of the shot.
w is the wind acceleration value, g is the gravitation.
Graphs of a zook shot with the same angle and power
0 wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%200%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)
Positive wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%201%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)
Negative wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%20-1%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)
More negative wind:
(http://graphsketch.com/render.php?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%20-2%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=500&image_h=300)
Play around here:
http://graphsketch.com/parametric?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%200%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=850&image_h=525 (http://graphsketch.com/parametric?mode=para&eqn1_color=1&eqn1_x=2t%20%2B%200.5%20*%200%20*%20t%5E2&eqn1_y=10t%20-%200.5%20*%204%20*%20t%5E2&eqn2_color=2&eqn2_x=&eqn2_y=&eqn3_color=3&eqn3_x=&eqn3_y=&x_min=-8&x_max=20&y_min=0&y_max=17&t_min=-10&t_max=10&x_tick=1&y_tick=1&x_label_freq=5&y_label_freq=5&do_grid=0&do_grid=1&bold_labeled_lines=0&bold_labeled_lines=1&line_width=4&image_w=850&image_h=525)
How this relates to the exact pixel movement in game i have no idea about..
That's a nice analysis there abe, gj
Yea, I think either WTF-8 or StepS could explain this a bit better... maybe DC/CS even?
Thanks, Sbaffo.
@TheMadCharles, there isnt really more to say on this matter. I'm sure the game doesnt calculate these curves in advance when you shoot - the projectile moves on a frame to frame basis. Maybe the AI worms use similar math to work out the zooking, dunno
Thanks to You I Passed my 8th Grade Math Final. :D :) ;D :o
Everything is related to math.
Worms came b4 math, same as god came b4 everything!
Quote from: nino on May 25, 2017, 07:50 PM
Worms came b4 math, same as god came b4 everything!
That's why if you ain't worming, you ain't true to god.
#AG nino
In case you're lazy, here's the formula.
x = x0 + vx0*t + w*t*(t+1)/2 y = y0 + vy0*t + g*t*(t+1)/2 vx = vx0 + w*t vy = vy0 + g*t