Hey I am making a game with basic a projectile that includes gravity and wind and I don't know how I can control the wind direction and power. Here is what I've got without wind:(adsbygoogle = window.adsbygoogle || []).push({});

Setup:

x = 0 /// x starting position

y = 0 /// y starting position

r = 10 /// radius of projectile

time = 0

g = 9.8 /// Gravity

theta = 45 /// 45 degrees starting angle

v0x = v * cos(theta * Math.PI/180) /// Angle in radians(?) multiplied by velocity

v0y = v * sin(theta * Math.PI/180) /// Angle in radians(?) multiplied by velocity

My method for calculating the X and Y position of the bullet is to increase the frameCount by 0.10 each frame:

BEGIN LOOP

y = y - v0y * time - (1/2 * g * (time^2)) /// "^2" denotes squared

x = x + v0x * time ///

time = time + 0.10 // increase time for the next frame

REPEAT LOOP

=============

So the way I interpret this is that every frame I apply gravity to the Y coord and no forces to the X coord (the force applied to the Y coord is: minus 1/2 * gravity * time squared)

Now I figured out if I apply more gravity and a force to the X coord it will act like wind is effecting the projectile however I don't know the proportion of extra force I should I apply to the X and to the Y to make it appear like there is a lot of wind effecting the projectile in say -45 degree angle.

Can anybody help?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Basic Projectile with Wind

**Physics Forums | Science Articles, Homework Help, Discussion**