[aps]gnat 29 Posted September 11, 2005 Seems the horizontal plane is not classed by OFP to be the true centre-line when getting/setting the position of a model. It seems to be about 2m heigher ...... It could be the 1.8m height-of-a-man thing but ......... Any know the exact O2 grid location that OFP uses as model centre ? Share this post Link to post Share on other sites
colonel_klink 0 Posted September 11, 2005 AFAIK there are three distinct centers of a model in O2. For the purposes of this exercise create a non proportional model with a concentration of vertices more to the left than to the right. Example create a sphere with 5 x segments and 5 y segments. next in tront view select some of the vertices and drag them away from the center, to give the object an unbalanced shpae. Doesnt matter how it looks for this exercise. Test the Model centers: The first is the center of the model vertices, Do this by selecting all the vertices of a model and then press C. The centerpont Pin represented by a '+' will go to the center of the selected vertices. I.E. if there are say more vertices on the right of the model than on the left the Pin will be closer to the left. The second center I believe is the center of the solid object represented by the size and number of faces. (I'm not totally sure of this however). Select all vertices as before then Select from the Menu bar Structure>Center All. This time the model will move in the 3D space. Press C again and note where the center is. (Note: using the Center All command will move every lod, so it pays to be careful with this). This confused the bejabbers outta me when I needed to discover the true center of an object. Quite often when you open up a BIS object you will notice that the object (truck, chopper, plane, etc) don't all sit tin the same area in O2 screens, I am presuming that the BIS modellers used the Center All command. How significant this is I have no idea. Third center (sort of) Additionally proxy objects are placed according to the proxy model's O2 center, so if the model is set according to its center in O2 by using Structure>Center All it is possible the model is offset to the O2 program center. Anybody who has placed Proxies, particularly driver or cargo proxies will know what I mean. Share this post Link to post Share on other sites
UNN 0 Posted September 11, 2005 Quote[/b] ]Any know the exact O2 grid location that OFP uses as model centre ? To add to what Colonel Klink said, you can also influence the centre within OFP, using the Autocentre property in the config. Or using properties in O2. When Autocentre is set to true, it will use something either similar to what Colinel Klink said, and/or the centre of gravity from the geo LOD? When Autocentre is set to false, it will use point 0,0,0 as defined in O2. Don't know if thats what you wanted, or you already know this. But it does make life easier when trying to align objects in OFP. So I thought I would mention it anyway Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 12, 2005 Thanks Klink and UNN ..... interesting stuff I had never played with before, but I did ........ and sh!t all changed ! My problem; I am using Footmunch and Geckos Tailgunner addon to add a tailgun to my B52. All works perfect until I roll the plane ......... yes you say, Roll is a problem in OFP, but its the weirdest thing ........ the EXACT position that Tailgun on the Backfire is the ONLY position it seems where the "camera" will roll the same as the plane. 0.5m higher or lower and its out of synch with the plane. ("synch" point appears to be ~0.6m above the planes roll axis) I tried this on the B52 where the roll centre-line is ABOVE the the gun .... but as you can see it doesnt work. Although the vertical position you will note is in line with where the Backfire gun might be (on vert. tail fin). The only solution would seem to me to move the roll axis. But, all my attempts to move the planes ROLL AXIS failed. - Moved "zarmeny" memory point - failed - Moved Geo weight centre - failed - Moved centre with respect to O2 grid - failed - autocenter =1 on the gun - no change How do I determine/move a planes roll axis? I'm now beginning to wonder what determines the axis point .... Relative to; - Pilot proxy ? - Elevator surface ? - Rudder ? - Alierons ? *sigh* .... another of these BIS enigma's Share this post Link to post Share on other sites
UNN 0 Posted September 13, 2005 Use a game logic in a cargo position, instead of SetCamRelPos. Position the gun object in O2, so the point whete it connects to the aircraft, is at 0,0,0. Then use autocentre=0 in the gun config. Setpos the gun at the position returned by the logic, and that will sort that problem out. Share this post Link to post Share on other sites
sa8gecko 0 Posted September 13, 2005 This will cause a CTD when the plane is damaged to a degree the AI automatically ejects. Using a 'dead' GL will cause the AI commander to order the tail gunner on the cargo space occupied by the dead GL. Share this post Link to post Share on other sites
UNN 0 Posted September 13, 2005 Quote[/b] ]This will cause a CTD when the plane is damaged to a degree the You need to setup your cargo position correctly, of course. OFP does not CTD when ejecting Gamlogics or Infantry from a cargo position. Try it with a BlackHawk in the mission editor. Quote[/b] ]AI automatically ejects. To cater for when the crew have been ordered to bail. Add scripts to the getout event, if a gamelogic is ejected, kill it and move it back in. Then eject the tail gunner, if he has not already ejected. Quote[/b] ]Using a 'dead' GL will cause the AI commanderto order the tail gunner on the cargo space occupied by the dead GL. As above, only use a dead logic when you need to. Sa8gecko, do you have the latest beta of the UKF MG Landrover? All this has been covered in that. @[APS]Gnat It's not a straight forward task, but at least get the game logics working so you can see if it's worth any more work. You can always ask, if you hit any other problems. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 13, 2005 Thanks UNN, think I'll give it a try ... but just to be clear; Models; - model the gun in O2 so its at the 0,0,0 grid position - Move the plane in O2 so that grid 0,0,0 is at the gun position - place a Cargo proxy on the plane @ the gun position (0,0,0) - Config for the gun has autocentre=0 Scripts; - Load a GL into the B52s "gun" cargo position - Read the location of the GL and setpos the manned gun there - repeat until detect a GL "getout" - if GL "gets out", kill it and put it back into the cargo (is that possible?! - eject the gunner - continue setpos the unmanned gun Obvious I have to be careful loading the cargo proxy at any time if I have other cargo positions available. ie loading the right cargo proxy Is that about the sum of it ? Thx Share this post Link to post Share on other sites
UNN 0 Posted September 13, 2005 Quote[/b] ]- Move the plane in O2 so that grid 0,0,0 is at the gun position You don't have to move the plane, just the gun. Although I'm suprised Autocentre on the plane did not work for you the first time round. But use AUtocentre on just the gun, so you can be exact in where you place it. Quote[/b] ]- place a Cargo proxy on the plane @ the gun position (0,0,0) Just place the cargo proxy at the point you want the gun to connect to the aircraft. Quote[/b] ]- if GL "gets out", kill it and put it back into the cargo (is that possible?! Yep, but you don't have to worry about that just yet. Quote[/b] ]Obvious I have to be careful loading the cargo proxy at any time if I have other cargo positions available. ie loading the right cargo proxy The best way is to make sure it's the first cargo position. If you have a co driver position, then you may have to move an extra logic in first, to get to the first cargo pos. If that makes sense? But yeah, other than that, thats about it for now. If your happy with the way it works, you can add all the extra stuff later. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 13, 2005 Well, that works quite well so far ..... but I did eventually manage to cause a CTD. OK, now what UNN? How do we stop the CTD ? Below is the code so far. TAILGUN.SQS <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; Based on; ; Tailgun script by Footmunch ; Adapted from SA8Gecko's multi gun script ; this is the addon INIT script ; Check for global deactivation of turret ?(GNT_B52_DisableTailGun != 0) : exit placeIt = loadFile "\GNT_B52\placeIt.sqf" _plane = _this select 0 _logicX= "logic" createVehicle [0,0,0]; _logicX moveInCargo _plane ;_camera = "camera" camcreate getpos _plane ;_camera camSetTarget _plane ;_camera camSetRelPos _pos ;_camera camcommit 0 _exit = 0 ? count (crew _plane) ==1: goto "crtGun" ; Get the pilot and the group _pilot = driver _plane _pilot_grp = group _pilot ; Create the gunner for the turret "SoldierWPilot" createunit [getpos _plane, _pilot_grp,"", 0.7, "PRIVATE"] ; Now get the whole group _tunits = units _pilot_grp ; And the turret gunner will be the last of the group (added latest) _gunner = _tunits select (count(_tunits) -1) ; Create the gun itself #crtGun _gun = "GNT_B52_TailGun" createvehicle[0,0,0] ; And put the gunner in _gunner moveingunner _gun ; Start the 'point backwards' routine [_gunner, _plane] exec "\GNT_B52\redirectgun.sqs" ; And set the action parameters _gun setcombatmode "RED" _gun setbehaviour "COMBAT" _gun setdir (180 + direction _plane) #MainLoop [_logicX,_gun,_plane,_pos,0] call placeIt @ (true) ~0.005 ? (!(driver _plane in _plane) || !(alive driver _plane)) and _exit == 0 and (position _plane select 2) > 20: goto "loop2" goto "MainLoop" #loop2 _exit = 1 if (alive gunner _gun) then {_gunner = gunner _gun; _gunner action ["EJECT",_gun];_para = "ParachuteWest" createVehicle [0,0,0];_para setpos getpos _logicX;_gunner moveindriver _para;} if (alive gunner _plane) then {gunner _plane action ["EJECT",_plane]} goto "MainLoop" PLACEIT.SQF <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; Based on; ; Tailgun script by Footmunch ; Adapted from SA8Gecko's multi gun script private["_camera","_gun","_plane","_pos","_MN"]; _camera = _this select 0; _gun = _this select 1; _plane = _this select 2; _pos = _this select 3; _MN = _this select 4; ;_camera camSetRelPos _pos; ;_camera camcommit 0; _gun setdir (180 + direction _plane); _gun setpos (getpos _camera); _gun setVelocity velocity _plane; comment { to get the _MagicNumber value for your turret fly above water, be sure the turret is in its proper place and uncomment the following line:}; comment { player globalchat format ["%1",_gun distance _camera]; }; if (abs((_gun distance _camera)-_MN)>0.0001) then { _gun setpos [getpos _gun select 0, getpos _gun select 1,(getpos _gun select 2)-(_gun distance _camera)-_MN]; if (abs((_gun distance _camera)-_MN)>0.0001) then { _gun setpos [getpos _gun select 0, getpos _gun select 1,(getpos _gun select 2)+((_gun distance _camera)-_MN)]; }; }; 1 Share this post Link to post Share on other sites
UNN 0 Posted September 14, 2005 Quote[/b] ]How do we stop the CTD ? When does it, CTD. When the AI try and bail out? Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 14, 2005 No, only when I was in the tailgun and was attacked by AA missiles. I've blown up and crashed many B52s but none caused a CTD. If the tail gunner AI ejects theres no CTD. When the B52 is damaged/killed, the tailgun remains "alive" and positioned appox. in the right position on the tail. The gun can still be boarded and used. I'll force a kill and see what that does. EDIT Yes, CTD's when AI (or player) are IN the plane and its destroyed. If the plane is empty or the AI have stepped out of the plane, it doesnt CTD. and the gun remains in place. Share this post Link to post Share on other sites
UNN 0 Posted September 14, 2005 Quote[/b] ]Yes, CTD's when AI (or player) are IN the plane and its destroyed.If the plane is empty or the AI have stepped out of the plane, it doesnt CTD. and the gun remains in place. We had a similar problem with MCar when logics were first introduced. Then it was something to do with the cargo proxies and config definitions not matching, i.e. transportsoldiers set higher than the number of cargo proxies. But if it's convenient, you could always send me a copy of your addon. Sometimes it's the timing of script commands that cause proxies to crash the game. While I'm at it, I could set it up for my AI runways to. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 16, 2005 UNN, I've tried adjusting the transport soldiers same, higher and lower than # cargo proxies ... no effect on CTDs. Tried ensuring all proxies matched in all LODs .... no change. Speaking of which, what LODs do you HAVE to have proxies placed in? Fire? Geo ? First LOD only ? The cargo and pilot views etc are obvious, but what about the others ? >> EDIT << Found it <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_logicX moveInCargo _plane _logicX setdamage 1 You have to kill the logic at the start. Share this post Link to post Share on other sites
UNN 0 Posted September 16, 2005 Nice one, did you say you had cargo slots for regular AI crew? I was about to post this: Ok I think I know what’s going on, both Sa8geko and I, where correct. Although in this case, Sa8geko is more correct Logics won't CTD when ejecting, but only if there placed in the mission editor first, or grouped with a logic that has been. They work exactly the same way as Infantry and the CreateVehicle command. When Logics are placed in the editor they belong to their own group, side Logic. When created with CreateVehicle, they belong to nogroup. The same way an Infantry guy would, if created with CreateVehicle. It's these nogroup units, that cause the CTD's when ejecting from aircraft, infantry and Logics. So Sa8geko was absolutely correct, using logics that way will CTD. So sorry Sa8, as I've seen group logics successfully ejected from aircraft, so I did not realize. Dead logics don't CTD when ejecting, so the solution remains the same. I'm guessing it's when OFP tries to put them in a parachute, as the CTD happens when you use the Eject action for a nogroup game logic. The crew bail when the dammage gets above 0.5. There are a few ways you can check for this, but the easiest is running this from the addons init event: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_AC=_This Select 0 _GL=_This Select 1 @Call {If ((GetDammage _AC)>0.5) Then {_GL SetDammage 1; !(Alive _AC)} Really you only need to run this, when there is an AI pilot, and the plane is flying. When either one of these are false, you should stop the script and set the logic back to full health. Otherwise you have to script the getin events to stop an AI unit taking it's slot, when it boards a cargo position. They will eject and dead bodies\logics. You might be able to combine this into the gun loop? Like I said, it’s not straightforward. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 17, 2005 Thanks UNN Yes, OFP may well be trying to put a logic into a parachute ...... certainly would explain, although why should that CTD ...... we can put a logic in a plane BTW, Im not get ANY ejection of logics, dead or otherwise, hence I dont seem to have to script for this. After a B52 is wrecked the Tailgun stays relatively in place, so the logic must still be there. Could well be because of; ejectDeadGunner=0; but technically the logic is not a gunner, its a cargo. Share this post Link to post Share on other sites
UNN 0 Posted September 17, 2005 Quote[/b] ]certainly would explain, although why should that CTD ...... we can put a logic in a plane I don’t know, I did not experiment further. I will try and move a nogroup unit into a parachute, and see what happens.But it won't CTD if they eject when the plane is on the ground or trying to take off, and aircraft are the only vehicles affected. I guess and CTD could be classed as a bug, perhaps there is time to fix this in Armed Assault? Quote[/b] ]BTW, Im not get ANY ejection of logics, dead or otherwise, hence I dont seem to have to script for this. It should only happens when a unit boards the aircraft on the ground. And then, only when there are no empty cargo slots before it. Dead units are ejected to make room for the one getting in. You can add some code to the getout event for when the dead logic is ejected, then you just restore the logic. Move the unit that pushed it out, move the logic back in and move the guy into the next free slot. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 17, 2005 Dead units are ejected to make room for the one getting in. Ooops .... thx UNN ... forgot about this ! As this unit now only has 1 cargo proxy (for the logic) I'll fix as you suggested. cheers. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 17, 2005 hmmm the GETOUT event will not trigger for (dead?) logics. Had to; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(_logicX in _plane) : goto "Swapcargo" in the main positioning loop ....... works fine anyhow. Share this post Link to post Share on other sites
UNN 0 Posted September 18, 2005 Quote[/b] ]As this unit now only has 1 cargo proxy (for the logic) I'll fix as you suggested. You can have more cargo places, but it does make life easier with just the one. Quote[/b] ]hmmm the GETOUT event will not trigger for (dead?) logics Ok, never done this with aircraft. Land vehicles work differently, although it's the same thing as a land vehicle ejecting it's cargo when it can't move. But you can do it the other way round if you want, add something to the GetIn event instead. That triggers when a unit tries to get into the logics positon. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 18, 2005 But you can do it the other way round if you want, add something to the GetIn event instead. That triggers when a unit tries to get into the logics positon. except the script then doesnt capture the logic's ID as it leaves so it harder. You'd have to use a global variable or ID for the dead logic, and I dont want to do that because that limits use. Anyway, the simple check if the logic is still aboard works fine. Share this post Link to post Share on other sites
UNN 0 Posted September 19, 2005 Quote[/b] ]You'd have to use a global variable or ID for the dead logic, and I dont want to do that because that limits use. I tend to use global arrays, to avoid all the problems of keeping track of what belongs to what. But if it works ok as is, it will make life simpler for MP. Do you have any problems with the AI commander ordering the rear gunner out, when there are vehicles with free cargo positions in the same group? Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 19, 2005 Do you have any problems with the AI commander ordering the rear gunner out, when there are vehicles with free cargo positions in the same group? Yes, I did, but now there is just 1 cargo its not a problem. You can do it with more than one, I did have him staying in place to start with, but then after I changed a proxy it stopped working. With a little experimenting and a bit of scripting I suspect you can eliminate the AI Commander's "man-shuffle". One way to beat the system (which I will try on ships soon) is to make all the other true cargo positions a separate addon that is setpos'ed just like the gun turret. Share this post Link to post Share on other sites
UNN 0 Posted September 19, 2005 Quote[/b] ]One way to beat the system (which I will try on ships soon) is to make all the other true cargo positions a separate addon that is setpos'ed just like the gun turret. If you add a driver proxy and move a logic in as driver, the commander stops ordering the AI to exit. I'm in the process of trying this with a ship addon myself, I will let you know how I get on. On ships in general, it's getting pretty good with multi gun versions. I can get enclosed gun turrets looking almost perfect. Share this post Link to post Share on other sites
[aps]gnat 29 Posted September 20, 2005 hehe ... sounds like we should be working on a navy together! Share this post Link to post Share on other sites