Results 1 to 2 of 2

Thread: Projectile Wind

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    7

    Exclamation Projectile Wind

    Hi,
    I am working on a game and i need a little help. In the game there are some projectiles(2d) being thrown. If someone could please help me add wind I would appriciate it. This is what i have so far in my loop. Everthing works so far, i just want a varible that willadd wind because i want to be able to change the strength and direction(left or right) at certain points. Thank you

    do
    .xcord = (Power(X) * Cos(Angle(X) * 3.14159 / 180) * .time)+ .startx


    .ycord = .starty - (Power(X) * Sin(Angle(X) * 3.14159 / 180) * .time - 4.9 * .time ^ 2)

    .time = .time + 0.1
    loop

  2. #2
    Zaei
    Guest
    Instead of using Angles to specify the direction of the projectile, use vectors, as you get far more control. Then, wind is easy. You simple have another vector for the wind direction, and a single for wind power. Then, do something like this:
    Code:
    Pos.x = Pos.x + (Vel.x + (Wind.x * windSpeed) *.time)
    Pos.y = Pos.y + (Vel.y + (Wind.y * windSpeed) *.time)
    'if 3d...
    Pos.x = Pos.z + (Vel.z + (Wind.z * windSpeed) *.time)
    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width