Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: WMCoolmon on April 04, 2006, 07:10:07 am
-
(http://fs2source.warpcore.org/temp/wmc/gunconvergence1.jpg)
Toggled on via a ships.tbl "gun convergence" flag. To change the angle of weapons, use the "Normal" field for gun points. Unfortunately, POFCS doesn't let you set gun/missile point normals, so you'll have to use ModelView.
Oh, and if somebody ever told you, "When fiery ordinance flies out a Viper's ass!!", now you can reply...
(http://fs2source.warpcore.org/temp/wmc/gunconvergence2.jpg)
"Oh, it does. It does indeed..."
http://fs2source.warpcore.org/exes/latest/C04042006.zip
-
I love you.
-
Excellent. People have wanted this for a long time :)
-
Awesome :yes:
Does this affect the lead indicator ?
Say, if I would set the normal 45° up from the forward direction, would the indicator move to the correct position ?
-
Does this work for secondary weapon firepoints as well?
And if so, can I stay locked on to a target so long as it's within the view cone of the firing point? Otherwise I won't be able to strafe with my bombs.
-
I tried it out myself; target lock is a bit odd but otherwise it seems to work just as well with secondaries. Here's something for you to try out, that I've wanted to do for a while. ;)
Advanced Countermeasures Test (http://web.njit.edu/~pjo3/slave1.rar)
(http://web.njit.edu/~pjo3/slave1.jpg)
It would be fun implementing this into a tertiary weapons systems for certain fighters.
-
LOL !! I'm gonna try it . Just hope it won't happen like the gun from this Viper :shaking:
-
Hmm, prtehaps it would be good to be able to specify a gun bank as "countermeasure" wich would bind it to the countermeasure launcher instead of a primary/secondary weapon...
-
so the normal is respected now? i'll make it editable
now i have to implement ITTS :D
-
It should converge at the maximum range of the weapon, not at a distance specific to the ship.
-
The weapon is rotated on the normal specified when it's fired, so whether it converges at all is up to the modder.
-
speaking of the viper, is there any place that i can get just the models of the battlestar galactica ships to import into FRED 2?
-
If it were that easy BtRL (http://www.game-warden.com/forum/forumdisplay.php?f=36) would be out by now :p
-
This means convergence for X-wings?!?!
-
If someone edits the POFs and tables to take advantage of it, then :yes:
-
hey this is pretty cool. this will work fine on my ships that have widely placed guns.
now, do blindfire :D
-
Coolmon, that's freaking amazing. Well done. :yes:
-
Now all we need is to combine this with a simple sphere and flak cannons plus the new "flak range" feature and fighters will have a new and evil capital ship weapon to fear..."Flak Shields" XD ;7
-
Good job man, looks sweet.
-
sweet, not get "blindfire" going (i.e the guns automatically leading a target to a degree or so inside the reticle, could be handy for some other mods where some fightercraft with turreted guns.
-
if you just made a fire turret weapon controll that would be cool, you could probibly script the blindfire gauge.
-
(http://fs2source.warpcore.org/temp/wmc/gunconvergence1.jpg)
Toggled on via a ships.tbl "gun convergence" flag. To change the angle of weapons, use the "Normal" field for gun points. Unfortunately, POFCS doesn't let you set gun/missile point normals, so you'll have to use ModelView.
Oh, and if somebody ever told you, "When fiery ordinance flies out a Viper's ass!!", now you can reply...
(http://fs2source.warpcore.org/temp/wmc/gunconvergence2.jpg)
"Oh, it does. It does indeed..."
http://fs2source.warpcore.org/exes/latest/C04042006.zip
You bastard, you got a Viper. I've wanted one of those for ages.
-
WMC's on the BSG:BTRL team. Of course he's gonna have access to a Viper. The real question is, how does he fit it in his garrage? :lol:
-
WMC's neighbor comes over, asking for a jumpstart. He opens his garage...
-
Woah. Nice work dude. Very handy. :D :yes:
-
I so like it! :)
Great job!
-
(http://fs2source.warpcore.org/temp/wmc/gunconvergence1.jpg)
Toggled on via a ships.tbl "gun convergence" flag. To change the angle of weapons, use the "Normal" field for gun points. Unfortunately, POFCS doesn't let you set gun/missile point normals, so you'll have to use ModelView.
Oh, and if somebody ever told you, "When fiery ordinance flies out a Viper's ass!!", now you can reply...
(http://fs2source.warpcore.org/temp/wmc/gunconvergence2.jpg)
"Oh, it does. It does indeed..."
http://fs2source.warpcore.org/exes/latest/C04042006.zip
Envious, just doesn't quite describe what I'm feeling........... grrrrrrrrrrr :eek: :eek2: :shaking:
-
Could someone take a moment to lay out the required mathematics for me?
I understand that I need: 1) the distance at which I want the projectiles to converge. 2) the offset of the gun mount from the center of the craft.
These give the base and altitude of a right triangle. I then need to transform the resulting angle into normals to enter in modelview. I presume that the hypotenuse of this triangle is the vector of the projectile. What I do not understand is how to derive the unit vector described by the hypotenuse and express it in the correct terms that modelview requires.
-
hypotenuse_angle = atan2((target_distance-gun_offset.z), -gun_offset.x)
unit_vector.x = cos(hypotenuse_angle)
unit_vector.z = sin(hypotenuse_angle)
EDIT: Corrected signs.
Note that atan2 is a c function which takes the y value (target_distance-gun_offset.z) over the x value (-gun_offset.z) like a normal arctan function, but returns the angle in the proper quadrant. IF you do this with a normal calculator's arctan function, you will need to take the absolute value of y/x before giving it to the function and correct them manually. (eg if gun_offset.z is positive, your answer will be 180-angle, otherwise it will just be angle). Otherwise you'll get values for a target behind and to the right of the ship when you calculate values forward and to the left of the ship.
-
i used to use a simple formula, simply pick a point in model space where the guns will converge, vector subtract the location of the fire point from it to get your directional vector, then normalize it. to normalize use 1 / sqrt(x*x + y*y +z*z). take the resulting number and vector multiply your directional vector by it.
-
Oh, and if somebody ever told you, "When fiery ordinance flies out a Viper's ass!!", now you can reply...
Very nice. Let me know when you've perfected the self-destruct kamikaze missile out the back. I've got a few people I'd like to give that to in loadout.
-
speaking of which i was thinking of making ships with a rather unorthadox weapon layout. which would include things like sidefire guns and torps. which would allow you to circle and shoot. and whatever target you had a hankering to shoot at would be dead. thing is you could attack a cap without being a stationaty blip in a turrets fov.
-
Oh, and if somebody ever told you, "When fiery ordinance flies out a Viper's ass!!", now you can reply...
Very nice. Let me know when you've perfected the self-destruct kamikaze missile out the back. I've got a few people I'd like to give that to in loadout.
You should be able to do that with a little weapons.tbl or -wep.tbm tweaking. See Detonation Range (http://www.hard-light.net/wiki/index.php/Weapons.tbl#.24Detonation_Range:) on the Freespace Wiki.
Alternatively, you can probably launch remote-detonation missiles out the back, but I don't know if they would show up on the HUD.
-
Here's a handy convergence calculator I made with Goober's help. Enter the desired convergence distance and the gun offset distance, and the spreadsheet will display the values to enter into the normal. Thanks for the help.
[attachment deleted by admin]
-
speaking of which i was thinking of making ships with a rather unorthadox weapon layout. which would include things like sidefire guns and torps. which would allow you to circle and shoot. and whatever target you had a hankering to shoot at would be dead. thing is you could attack a cap without being a stationaty blip in a turrets fov.
That's where thrusters in main FS2 would be extraordinarily useful.
-
Here's a handy convergence calculator I made with Goober's help. Enter the desired convergence distance and the gun offset distance, and the spreadsheet will display the values to enter into the normal. Thanks for the help.
:yes:
EDIT: Have you tested the calculator? It looks like your x and z values are reversed.
-
Is it even needed to use normalized vectors for the firing point normals? (AFAIK it is but i aint 100% sure)
I mean if the use of 'unnormalized' vectors is allowed then it is really, really simple to set the normals for what ever convergence you like..
-
Simple if you understand vectors, which most people (myself included, do not). I wanted the most basic way possible to get at what to enter in Modelview. With this spread you only need to know the gun displacement from center and how far off you want the projectiles to meet.
I forgot to save my changes after reversing the labels in the spread. Attached it again.
[attachment deleted by admin]
-
Umh.. the exact same is needed for the unnormalized vector too... x & y coordinates for the normal equal to the opposite of the firing points respective coordinates and z equals to the convergence distance (minus the weapons z coordinate - if the design is really weird)...
Though that proggie will most likely have its users as vectors are at times seen as being too difficult to understand.
-
The issue being that many folks, myself included, will have no idea what that first sentence of yours means. :)
I can only interpret that to mean that I can put in the distance in meters for offset and distance in both the x and z boxes in pcs2 without transforming them in any way. The simpler it is for people to understand how to use what the SCP has created, the more likely it is that these features will be used without endless "HELP" threads being created.
-
I think what he meant is that right now you only have a "distance from center" box. But a gun point could be translated anywhere (and I feel like a dumbarse for not realizing this before) along the x, y, and z axis, and all of those would mean different normals. If you have a gun point 20 meters from center, is it 20 meters vertically, horizontally, or forward/back?
So what I said before is incomplete. The calculations should be the same for x and z, but you will also need to calculate the normalized 'y' component too, so the guns will tilt up or down if they're moved up or down.
So you need three cells for 'gunpoint offset from center'. Here:
(http://fs2source.warpcore.org/temp/wmc/gunconvergence_a.gif)
As you can see, even though the red gunpoint in "2" is the same distance as the red gunpoint in "3", the normal vector values are different because the one in "3" is moved to the right, while the gunpoint in "2" is moved back from the center. Also note that while both gunpoints in "3" are 1m to the right of the center of the spacecraft, the angle is slightly different for the pink gunpoint because it is also moved back 1 meter. "4" shows the distances I used for the calculations.
That same graph above could be used for y values. Rotate it to the left 90 degrees, and swap the "x" and "y" values; the z values will remain the same. (assume a conical spacecraft :p)
(http://fs2source.warpcore.org/temp/wmc/gunconvergence_b.gif)
I wasn't too careful with the calculations so they could be wrong, but the signs and general magnitude look OK.
-
I think here would be a good place to mention that PCS2 has a built in normal calculator so you never have to actually do this math by hand.
-
there are still cases where i perfer my own normals. like when im going for a scatter effect. :D