j0nes 194 Posted May 12, 2013 ok, I need help :) the autopilot is still far from perfect, but Ive torn it to pieces and cant find a way to improve it any further. here is the core: ac130_rot_camera: (rotates a center logic to "tie" the plane to) while {LDL_ac130_active && !LDL_ac130_abort} do { sleep 0.01; //Angle for rotating (if plane is not heading to another position) //Due to synchronisation (avoid shaking camera) these lines are here (camera script) LDL_cam_rotating_angle = LDL_cam_rotating_angle - 0.1; //Plane position [LDL_ac130_plane, LDL_cam_rotating_center, LDL_cam_rotating_radius, LDL_cam_rotating_angle, LDL_cam_rotating_height]call LDL_setCirclePosition; }; set circle position: (creates a circular path for the aircraft to follow) LDL_setCirclePosition = { private["_center"]; _center = getPosASL (_this select 1); (_this select 0) setPosASL [(_center select 0)+sin(_this select 3)*(_this select 2),(_center select 1)+cos(_this select 3)*(_this select 2), (_this select 4)]; }; ac130_rot_main: (loop that changes the angle of the plane with adjustments in radius, height or movement) while {alive LDL_ac130_plane && alive player && !LDL_ac130_abort} do { sleep 0.1; //Plane Axis []call LDL_ac130_correctAxis; //Set new position if (LDL_mouseButtons select 1) then { LDL_destination setPos screenToWorld [0.5,0.5]; [LDL_logic_plane, LDL_destination, LDL_cam_rotating_radius, LDL_cam_rotating_angle, LDL_cam_rotating_height]call LDL_setCirclePosition; _ang = [LDL_ac130_plane, LDL_logic_plane] call LDL_mando_angles; _dif = _ang select 1; if (!(_dif < 1 && _dif > -1)) then { LDL_flyMode = 2; //waiting to float }; }; if(LDL_flyMode == 2) then { //waiting to float [LDL_logic_plane, LDL_destination, LDL_cam_rotating_radius, LDL_cam_rotating_angle, LDL_cam_rotating_height]call LDL_setCirclePosition; _ang = [LDL_ac130_plane, LDL_logic_plane] call LDL_mando_angles; _dif = _ang select 1; _pos = (worldToScreen getPos LDL_destination); if (count _pos != 2) then { _pos = [-1,-1]; }; if (_dif < 1 && _dif > -1) exitWith { LDL_flyMode = 3; //float LDL_cam_rotating_center setPosASL [getPos LDL_cam_rotating_center select 0,getPos LDL_cam_rotating_center select 1,getPosASL LDL_destination select 2]; [LDL_cam_rotating_center,LDL_destination,1,1,false,false]spawn LDL_ac130_rot_float; }; }; }; //Remove DEH again on exit (findDisplay 46) displayRemoveEventHandler ["keyDown",LDL_KeyDownDEH]; (findDisplay 46) displayRemoveEventHandler ["keyUp",LDL_KeyUpDEH]; //Close Dialog LDL_dlg_display = "null"; []call LDL_dlg_changeDisplay; LDL_ac130_abort = true; LDL_ac130_active = false; LDL_mando_angles: (checks if one object is the the field of vision of another object, this is for moving the center of rotation) private["_obj1", "_obj2", "_ang", "_dif", "_infov"]; _obj1 = _this select 0; _obj2 = _this select 1; _circle = 360; _ang = ((getPos _obj2 select 0)-(getPos _obj1 select 0)) atan2 ((getPos _obj2 select 1)-(getPos _obj1 select 1)); _dif = (_ang - getDir _obj1); if (_dif < 0) then {_dif = _circle + _dif;}; if (_dif > 180) then {_dif = _dif - _circle;}; if (abs(_dif) < 43) then { _infov = true; } else { _infov = false; }; [(_ang +_circle) % _circle, _dif, _infov]; ac130_rot_float: (moves the plane to new orbit) private ["_object","_targetInput","_velocity","_distance","_correctAngle","_setFinalPos","_target","_heightStart","_heightNow","_posWtoM","_xMissing","_yMissing","_distance3D","_xWalk","_yWalk","_ang"]; _object = _this select 0; _target = _this select 1; _velocity = _this select 2; _distance = _this select 3; _correctAngle = _this select 4; _setFinalPos = _this select 5; _object setPosASL [getPos _object select 0,getPos _object select 1,getPosASL _object select 2]; _heightStart = (getPosASL _object select 2); _heightNow = _heightStart; while {(_target distance _object) > _distance && LDL_flyMode == 3} do { sleep 0.1; _posWtoM = _object worldToModel (getPos _target); _xMissing = _posWtoM select 0; _yMissing = _posWtoM select 1; _distance3D = (_target distance _object); _xWalk = _xMissing/(_distance3D*_velocity); _yWalk = _yMissing/(_distance3D*_velocity); _object setPosASL [(_object modelToWorld [_xWalk,_yWalk,0]) select 0,(_object modelToWorld [_xWalk,_yWalk,0]) select 1,_heightNow]; if (_correctAngle) then { sleep 0.1; _ang = [_object, _target] call LDL_mando_angles; _object setDir ((getDir _object) + (_ang select 1)); }; }; if (_setFinalPos && LDL_flyMode == 3) then { _object setPosASL getPosASL _target; }; if (LDL_flyMode == 3) then { LDL_flyMode = 1; }; Share this post Link to post Share on other sites
dissaifer 10 Posted May 12, 2013 Very cool mod you are working on. I saw the post about the lag and was going to try to help but in using it noticed some things. 1. If you switch to the map from gunner mode, you have the gunner's target on the map. 2. if you are the gunner, and you set a Waypoint that gets ignored for the circling (auto pilot) 3. Idea about the circling, while the math is correct, it's a bit much to constantly calculate. i didn't have a problem on my machine with it, but a suggestion is to calculate like 8, 16, or whatever makes a smooth enough circle via waypoints from the center of your loop, make the last one a cycle. That way you only have to calculate the waypoints once. If the user hits a button to increase/decrease the loop, erase all the current waypoints and recalculate them. This should reduce the lag greatly for others. 4. Oh, and you can't switch from gunner to pilot - not sure if that was on purpose or not, but it'd be a nice feature. Share this post Link to post Share on other sites
panther42 52 Posted May 12, 2013 I have to agree with Dissaifer, constantly setPos'ing a vehicle in flight has never worked well in my tests. Let the plane fly naturally by giving waypoints on a circular pattern. I am not a pilot, but I have never seen a plane fly a consistent "perfect" circle... If you need some examples using "circular" waypoints, I'm sure myself, or others would be happy to offer some. Share this post Link to post Share on other sites
legolasindar 3 Posted May 12, 2013 Nice addon, good job :) I recommend you see this other AC-130 addon for search ideas and solutions. I suggest you some many changes for more realism. Sorry for my english. You can see real monitor in this HD video, but this is probably the AC-130A or E Spectre (ignore title of the video, is wrong). In this other video you can see the AC-130H Spectre monitor. And if you read this thesis about AC-130 Urban Close Air Support, in the page 33 you can see the reals magnifications of the AC-130, 1.8, 10.8, 42.9, and 85.8. The other question is about tracer, if you see real operations, can see the AC-130 not use tracers, is simply, you do not want the enemy to have a clear vision of where you are. For this i thing is more good set False for tracers by default. http://www.youtube.com/watch?v=UcAoVo3SzRI And in my case the gunners screen in P-FCO and S-FCO trembles (shake) constantly, which prevents me from seeing anything clearly. But is a good addon, i follow you work Share this post Link to post Share on other sites
Killbilly 10 Posted May 12, 2013 Brilliant addon! I agree, though, that it would be nice for those of us who are primarily "singleplayer" folks to be able to switch from pilot to gunner and back. Currently, the only way I've been able to do that is to set another unit as "player" and then the AC130 as "playable as pilot or gunner." It's workable, but a regular ability, though not realisitic, would be nice if you'd consider it. As long as you're doing us all favors, some regular low-viz textures would look really good on this model ;). What a great addition to the game, though! Thanks very much! Share this post Link to post Share on other sites
j0nes 194 Posted May 12, 2013 thanks guys for all the feedback! 1. I have no Idea why you cant switch from pilot to gunner and back, its set up so you can, and Ive never had a problem with it not letting me, but ill take a look! 2. the cursor staying when you go to map is something ive been looking at, I just need to find the right syntax tell the script that the player is looking at their map 3. the autopilot script IS LDLs script from the AC130 everyone knows, its just been modified heavily to only rotate the plane, instead of also adding cameras/dialog/etc. 4. since the camera is not a script, but a vanilla turret, Im not sure what (if anything) I can do to stabilize it. I might try peeking into some of the ACE scripts, but from what Ive seen, the only way people can stabilize turrets is by attaching a camera, which is exactly what Ive been trying to avoid. The only thing I could think of would be there might be a way to use the "cursor target" and write something to the effect of (no idea about syntax) scan for object closest to the target and fix the camera to it, if the camera moves to far, find another object, repeat. 5. the shaking is from the autopilot do to all of the recaclulations. 6. if the turret is aiming below a certain degree Arma thinks its under the plane and youll be able to hold it down easier (smaller orbit is better) but if it gets above that degree level then the game thinks the turret is on top of the plane and trys to keep it level like an autostabilized tank turret 7. @legolasindar as far as making it more realistic what did you have in mind? (watched all the vids, thanks!) was it just making the camera not shake or making the screen look different? 8.This mod was originally going to just be put out for ArmA III. so I want to make it as realistic as possible, which is why I included all of the ammo from current era gunships and want to make the camera stable, but I also wanted to take some futuristic liberties, all of the flir modes, ammo types, etc. Share this post Link to post Share on other sites
Nichols 243 Posted May 12, 2013 Knowing a few guys that fly these puppies for real I gotta say that it is a nice thought. However two things come up for me on the camo side. 1) Rarely are they flown in support of daytime operations. 2) The paint scheme is all wrong. http://www.fas.org/programs/ssp/man/uswpns/air/attack/ac130.html Change the paint scheme and you have a winner in my book. Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 IVE GOT IT!!!!! I HAVE SOLVED THE WORLDS PROBLEMS!!! so after looking through countless "the BIS uav sucks..." posts I started thinking about you the uav/ac130 works in real life and translating it to arma terms ok so heres what ive got ( if this works, the AP can almost be taken out completely) 1. create a STATIONARY local game logic at cursortarget and use screentoworld (or worldtoscreen, cant remember which) when youre in the gunners seat 2. lock the camera to that game logic 3. move the game logic when theres user input -this wouldnt be done with mouse eventhandlers it would be saying, if the game engine moves the turret (aka, rotation angles) then keep it still (max turret rotation speed is 1000 so that shouldnt be a problem) -but if the player moves the turret then move the gamelogic with the turret until the player STOPS moving the turret 4. this means the game logic remains stationary on the ground and youre essentially using THAT as your turret and the camera is just following yes I know this sound like a round about way of doing it, but I think I can, and it probably sounds a lot clunkier when I explain it without the proper code, ill run some tests and get back to you! Share this post Link to post Share on other sites
Killbilly 10 Posted May 13, 2013 So, are you saying that the plane would rotate around whatever the gunner is aiming at? Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 nope, let me explain it this way. in the Armaverse there are three basic forces that act on a turret 1. environmental movement (in this case rotational) 2. stabilization (even when defined as "stabilizedinaxesnone" the turret still wants to stay level) 3. user input there is only one force that acts upon game logics 1. user input therefore, if you create a game logic at a set position (say 5 meters in front of the camera off the left side of the plane) and move IT, then there is only one force acting upon it (user input) But if you just wiggle around a game logic, your turret wont do anything different, so you have the turret "track" the movement of the game logic, within a set field of view. the third part of this however, is that the turret/cursor target is attached to the game logic, not vise versa, and the gamelogic is "stuck" to the ground at the point that the camera is looking at. imagine it like this: -a hula-hoop is 5m above the ground, parallel to the ground (this representing the orbit of the plane) -there is a rubber band attached to the hula-hoop at one end and a metal weight at the other (this representing the view of the gunner and the weight representing the game logic) -now rotate the hula-hoop around the center of itself, not the weight -no matter where you place the weight, within a certain point, the rubber band will always be going directly from the hoop to the weight -now have a friend turn the hoop and you move the weight, the rotation of the plane is now completely independent from the "view" of the camera does that make any sense? haha this is harder to explain than I thought... ---------- Post added at 02:31 ---------- Previous post was at 01:38 ---------- I now see why no one has done this before..... theres more calculations per second in this than a camera script and its 10000000000 times as hard.... I shall continue racking my brain...and drinking Coke Share this post Link to post Share on other sites
Killbilly 10 Posted May 13, 2013 Ahhh. Very clever. Sometimes the simplest things are the hardest to explain, eh? That certainly does sound like a good solution. I'm anxious to see what you come up with. Thanks again for all your hard work on this excellent addition. I'd send you some more Coke if I could. :) Share this post Link to post Share on other sites
kill4eva 10 Posted May 13, 2013 Only providing feedback after using your mod: with so many FLIR visions to choose from, a clickable/usable UI gunner HUD would be nice. Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 (edited) three options FLIR hotkeys: (1 = normal, 2 = nvg, 3 = Whot, 4 = Bhot, etc.) scroll menu: ("flir options" ----> brings up GUI) hotkey: (press N -----> brings up GUI) Edited May 13, 2013 by J0nes Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 new "special operations" camo why? because Im tired of thinking so "color between the lines" sounded quite enticing Share this post Link to post Share on other sites
Harzach 2517 Posted May 13, 2013 (edited) Regarding the camera and your idea above, ground stabilization is something that people have been clamoring for since just about forever. It has been proven possible a number of times, but I've never seen it actually employed by any addon released to the public. A great example here: Of course, this is all RTT, so it's not directly relevant here, but your musings reminded me of this video and made me think that it was definitely doable. Also, RTT being a feature of A3... Anyway, watching your progress with keen interest! Edited May 13, 2013 by Harzach Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 ha! I actually just saw this video earlier today! just out of curiosity.... does anyone know if you can create a camera but not look at it? just use it as a control surface? Share this post Link to post Share on other sites
kill4eva 10 Posted May 13, 2013 or better yet Jones...how bout tone it down a notch on FLIRS? N= normal, NV (normal green/bhot), Thermal (whot/bhot). :) Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 haha what part about All weather tv dont you get?? gotta be prepared for cloudy with a chance of meatballs(the book, not the movie) in other words, yes Ill change it :) Share this post Link to post Share on other sites
legolasindar 3 Posted May 13, 2013 7. @legolasindar as far as making it more realistic what did you have in mind? (watched all the vids, thanks!) was it just making the camera not shake or making the screen look different? I try to explain AC-130 MFD simbology: http://img12.imageshack.us/img12/6713/ac130e.jpg (180 kB) And the other i saying is about of zoom, this optics not use progressive zoom, use prefixed zooms, 1.8, 10.8, 42.9, and 85.8 magnifications. I recommend see this WIP addon, you can see PIP, and clicable cockpit. Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 sweet!! thanks for the insight! Share this post Link to post Share on other sites
kill4eva 10 Posted May 13, 2013 Perhaps quality could be better, but this video could provide you some good insight on reticle & zoom functionalities :) Share this post Link to post Share on other sites
j0nes 194 Posted May 13, 2013 just a heads up, this WILL be released for A3, theres just more out there in the ways of knowledge for A2, so once it works, porting will be a snap. but in the A3 version there will be PIP optics, as well as a clickable cabin Share this post Link to post Share on other sites
legolasindar 3 Posted May 14, 2013 I found this Declassified Report on Fixed Wing Gunships in SEA. http://www.spectre-association.org/pdfs/114185246-Fixed-Wing-Gunships-in-Southeast-Asia.pdf And this other document. http://www.scribd.com/doc/129710993/Lockheed-AC-130-Gunship-docx Share this post Link to post Share on other sites
j0nes 194 Posted May 14, 2013 ok, I dont mean this to be rude in any way. As a kid whose bedtime stories were airplane specs, this is all incredibly interesting. However, the first step towards realism is the camera stability problem, so as a community who wants a perfect gunship, we should focus on one problem at a time, I am working my hardest, but I also have a life (sometimes) as well as other Arma projects :) Someone posted in another thread that there was some kind of "gunship compensation" on the ACE eurocopter tiger gunship. does anyone know what that is? Share this post Link to post Share on other sites
nimrod123 11 Posted May 17, 2013 dropbox no work? i'm getting "file deleated or moved" Share this post Link to post Share on other sites