Really Need Some Math Help

wingdnosring

New Member
Reaction score
16
Okay guys, prepare to put your thinking caps on, because this is tough.

I have a computer player that shoots at a user controlled player. The weapon has a fixed arc set. Here is the formula for the arc.

Vz = Bullet Speed * (sin(pitch)/0.7)

Then every 0.06 seconds, this happens:

Vz = Vz - (Vz * (0.06 * ArcSlope))
Change missile's height to Missile's Height - Vz

This works fine when a user-controlled unit is shooting, because its target is simply the gorund and the user controls his own camera. For computer players however, I need to somehow find out what the initial pitch must be for the arc to land squarely on the unit's target.

How do I solve for pitch?

Keep in mind I know the following: Bullet Speed, Arc Slope, Distance between Target and Aattacker, XY angle from Target to Attacker, Z angle from Target to Attacker, all three angles in a triangle that links Target and Attacker on the Z axis, Number of times the missile will have its height changed, and the height difference between Target and Attacker.

I can use any of those. Keep in mind that the missile could hit the Target halfway through its arc or at the very end, it's impossible to say.

If it helps, pitch is equal to this: ((initial Vz) * 0.7) / Bullet Speed

The problem is finding the initial Vz when it's increase/decrease is a percentage of itself. It's an unknown that builds upon the unknown :(.

[Edit]: I think I need to solve for Vz in its initial stage. So I have to take the height and number of runs and plug them into a geometric series function? Does that make any sense?
 

Frozenwind

System maker
Reaction score
99
This is more of a camera question as a math question as it seems, since it only doesn't work for the computer.

Try setting your camera to the same target as the computer's camera, so you know what he sees. This might help you to solve it. I haven't studied the sc2 cams yet though.
 

wingdnosring

New Member
Reaction score
16
He doesn't use a camera at all. The triggering is entirely different for users vs computers. Keep in mind that 100 units could all be lobbing something at once and the Arc Slope differs from weapon to weapon, so I can't just use a set value.

I'm totally stumped on this one, I've spent almost 2 hours trying to solve it.
 

Frozenwind

System maker
Reaction score
99
Hm, so let me see. You need to find a formula similar to a user's formula using a camera angle, for a computer player who doesn't use a camera at all?

Impossible for me to solve this atm, can tell some more about your map, besides the formulas above?
I mean, what exactly are you doing? Is it a shooter like shooting a bullet with the center of your screen as source, or?
 

EnderA

New Member
Reaction score
0
I'm likewise unclear on what's actually going on.

Who's shooting what at what? Is it homing or not? Does it lead or target the current position? Do you want a realistic (parabolic) arc or something else?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top