MaxAngleDif weirdness.

MaxAngleDif weirdness.

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

MaxAngleDif weirdness.

Post by Archangel of Death »

When using maxangledif with multiple weapons of the same type and maxangledif setting instead of aiming half the set number in either direction, as it should, it aims the full value all the way around. Eg: setting it maxangledif=170 makes the weapons only aim along the angles 0 to 170, instead of -85 to 85.

I can't confirm any other situations in which this happens, whether or not its only when they are the same weapon or have the same maxangledif setting.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

Eh... you're supposed to use the WeaponMainDir to do that, stupid ass... just make the WeaponMainDir 85 or -85, with a 170 degree arc... of course, you'll have to figure out how to convert 85 to the 0 0 1 format...
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Um, the center of the cone is supposed to be forward, and WeaponMainDir is supposed to be "center direction of a cone" (as written in the changelog). So leaving it default (center of cone directly forward like I want), and giving it a max angle difference of 170 should make it able to aim up to 85 degrees left or right of that center of the cone (and up and down). At least, that is how it is supposed to work, and does work when, for example, you only have one weapon using it.
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

oh, right. ok. Now why couldn't you tell me this when I was asking you about it on irc and was more awake.
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

Stupid ass? well that's mature...

it is a great feature though.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

Hehe, it's a love/hate relationship ;) He knows I wasn't trying to be offensive with that... or at least he should have!
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

(edited this for making a little more sense)

Hope this helps everyone :-)

Had a conversation with SJ last night... that combined with some aggressive experimenting led me to figure out exactly how these tags work.

WeaponMainDir2=0 0 1;
maxangledif2=320;
This give the weapon an arc of 320 degrees in total, or 160 to either side. Pretty simple, this is all we thought this was good for.

Image

WeaponMainDir5=5 0 1;
maxangledif5=180;
Now, to anyone who knows the first thing about these tags, this must look very odd, no? But they're much more complex than any of us realized - it's triginometry. Because of the 1 in the "front" section (0 0 1), it "pulls" the arc in that direction a bit. So you get something like this:

Image

WeaponMainDir4=-5 0 1;
maxangledif4=180;
And here's another interesting thing. The numbers can be integers (negative), giving the opposite direction arc.

Image

Finally, at the end of the process I put these three guns (there's two more, on this unit, but forget about them...) you wind up with these overlapping arcs:

Image

The practical upshot of this is that... well, if you can't recognize it yourself I'm not sure I can explain. One example in living colour is the Arm Epoch in Absolute Annihilation. It has its arcs configured as above and now when it encounters its Core counterpart, it will win the battle if it can keep all its arc in line with it, but will lose the battle if it can't. Nifty, huh?

Also, unlike scripted aiming limits, turrets configured as above will not attempt to aim at targets that are outside their arc and get stuck.

Oh, and the middle number is the up/down axis. So you can configure turrets to only aim down, for instance.
Last edited by Caydr on 06 Nov 2005, 17:11, edited 1 time in total.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

That red text isn't totally true. If a unit only has one weapon, and that weapon is arced, the unit will physically turn itself to accomodate weapon fire. It doesn't if you add more weapons, though, even if they have the exact same arc (in my experience).

Also remember that arcs apply vertically as well. Try a MaxAngleDif of 10 and then do an FPS view and try to fire very high--you'll see what I mean then. It literally makes a cone like the changelog says.

[edit] Someone should put the data on this page together and post a wiki article ;)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Caydr wrote:Now, to anyone who knows the first thing about these tags, this must look very odd, no? But they're much more complex than any of us realized - it's triginometry. The largest number is the hypotenuse, the smallest number defines the adjacent sides. Now, obviously, the above-described triangle is impossible. But Spring normalizes it into something reasonable. Furthermore, because of the 1 in the "front" section (0 0 1), it "pulls" the a
I thought the group of three numbers defined a vector, for instance WeaponMainDir1=3 5 7; would mean draw an arrow from x=0 y=0 z=0 r to x=3 y=5 z=7 to define the fire direction.

I fail to to make any sense of the explanation that involves the three number being the side of a right triangle.

And I just realised I can't make a weapon with a limited angle on the horizontal plane but a -90° +90° angle vertically. :cry:
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

Mm... Can't you set it so that the point of reference is directly above the unit with a 180 degree arc of fire?

Sorry if my explanation is bad, I'm having trouble understanding the system myself. It works though. Just re-read my explanation, I can understand why it doesn't make sense to you :oops: Wrote it in a bit of a hurry...

Basically, the numbers are "pulls"... you can "pull" the weapon's arc one direction or another by changing the numbers. So if you want the weapon to have an arc with a midpoint 45 degrees to the left of the front (or right... sorry) you would set it to:

1 0 1 (or -1 0 1... whichever)

If you increase the numbers one direction or the other, you can give the weapon any angle you want if you figure it out with triginometry. For instance, for a midpoint approximately 10 degrees to the left (or right... ugh)

1 0 10 (actually I guess this is more like 9 degrees, right? Meh.)

For about a 60 degree angle midpoint..0

3 0 2

The higher the numbers you choose, the greater the degree of accuracy.

For a space-themed mod, you might use an arc like this one:

1 1 1

with a 90 degree arc or so. This would be one of the forward turrets with a fairly narrow field of fire, which cannot fire very far below itself. It might be accompanied by a

1 -1 1

turret which would cover the underside. Then you could add

-1 1 1

-1 -1 1

for accompanying weapons on the other side of the unit. The unit would have a powerful frontal attack with the possibilty of firing in other directions with limited firepower.

Its aft is completely open to attack though, so it could have a point-defense gun with a 180 degree arc:

0 0 -1

Anyway, there's a few examples. Hope this helps you understand.
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Erm, um. Maybe put the trig in that post as well?
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

.... hm.. It's just something I can visualize now that I know how it works. I'll try to make a legible techinical drawing sometime soon.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

can anyone explain this a bit more?
Whats the first number for, the second and third?
What stand the values for? When i read the posts above, i dont think that they are degrees.
If I want a Weapon only fires to the left side with a 180° firefield, what numbers do i need?
What if i want a Weapon only fires backward with a firefield of 200°?

I tried it ig but with no result with this line
weaponmaindir6=0 0 1;
maxangledif6=200;

This unit was able to fire everywhere with turret 6 :(.

Thanks
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

As I understand it, the 3 numbers are coordinates of a vector which defines main firing direction of a gun. They seem to be in x y z order, so 0 0 1 is a vector pointing forward (all vectors originate from 0 0 0). 0 0 -1 will be a vector pointing backward. z axis is forward-backward, x axis is left-right, y is up-down, so leftside will be 1 0 0 (can be rightside, I'm not sure about the sign). One more thing is that 0 0 10 is the same direction as 0 0 1 or 0 0 100 or 0 0 0.1 as the length of the vector is not used.
MaxAngleDiff seems to set a firing arc, so that MaxAngleDiff of 360 means can fire everywhere, 180 - half a circle.
I tested this with units and yes, this setting makes turrets only engage targets backwards of the unit. This can be tested by force-firing on the ground in several places around the unit.
But I noticed a few interesting things: sometimes if an enemy unit is "locked" by a turret and then moves out of the firing arc, turret will continue to track this unit even outside the arc. Especially noticeable on battleships trying to hit planes and turning turrets after them no matter their firing arc settings (I was testing all this firing arcs stuff with a battleship as they seem to be most appropriate for this). The settings for the rear turret were 0 0 -1, maxanglediff 270. In force-fire mode it could not fire forward, it could not even aim there (backward was ok), but if tracking a plane, it could.
Post Reply

Return to “Help & Bugs”