Jump to content
Gemini

Dynamic Object Compositions (DoC)

Recommended Posts

KevsnoTrev,

Thanks i didn't think of that. The next problem i have is when i spawn my composition it doesn't add the texture what am i doing wrong?

Composition:

private ["_objs"];
_objs =
[
["Land_Mil_WallBig_4m_F",[-2.80908,-1.54688,0],270,1,0,[],"","",true,false], 
["Land_Pallet_MilBoxes_F",[-5.59009,-1.23584,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-2.80298,-5.38965,0],270,1,0,[],"","",true,false], 
["Land_Pallet_MilBoxes_F",[-5.6062,-3.37012,0],342.79,1,0,[],"","",true,false], 
["Flag_US_F",[-4.24731,-7.3999,0],0,1,0,[],"","",true,false], 
["Land_FieldToilet_F",[2.4082,7.93652,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_Corner_F",[-2.73975,-8.86377,0],270,1,0,[],"","",true,false], 
["Land_BarGate_F",[5.32056,-8.66943,0],0,1,0,[],"","",true,false], 
["Land_FieldToilet_F",[4.31519,7.93604,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[1.43481,9.55371,0],180,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-2.41333,9.55322,0],180,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-6.21143,-8.8335,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[5.27222,9.55859,0],180,1,0,[],"","",true,false], 
["Land_Cargo_Tower_V1_F",[-10.0276,-1.6084,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-6.25073,9.54834,0],180,1,0,[],"","",true,false], 
["Land_MetalBarrel_F",[-8.49146,7.14209,0],0,1,0,[],"","",true,false], 
["Land_MetalBarrel_F",[-9.24658,6.69531,0],0,1,0,[],"","",true,false], 
["Land_PaperBox_open_empty_F",[9.81592,5.89844,0],15.9589,1,0,[],"","",true,false], 
["Land_MetalBarrel_F",[-9.24683,7.55664,0],0,1,0,[],"","",true,false], 
["Land_Cargo_House_V1_F",[12.1306,4.29932,0],90,1,0,[],"","",true,false], 
["Land_Cargo_Patrol_V1_F",[11.1123,-5.6792,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[9.15625,-8.80811,0],0,1,0,[],"","",true,false], 
["Land_PaperBox_closed_F",[10.3582,-6.80078,0],152.532,1,0,[],"","",true,false], 
["Land_Cargo10_military_green_F",[-10.9209,6.63672,0],90,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[9.12427,9.5542,0],180,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-10.0637,-8.83643,0],0,1,0,[],"","",true,false], 
["SignAd_Sponsor_ARMEX_F",[9.15869,-9.41406,0],0,1,0,[],"","this setObjectTexture [0,'A3\Data_F\Flags\Flag_us_co.paa'];",true,false], 
["Land_Mil_WallBig_4m_F",[-10.1028,9.55273,0],180,1,0,[],"","",true,false], 
["Land_PaperBox_open_full_F",[12.3655,-7.08252,0],0,1,0,[],"","",true,false], 
["Land_CampingTable_F",[13.677,5.86621,0],90,1,0,[],"","this enableSimulation false; [this,0,73] call BIS_fnc_setHeight;",true,false], 
["Land_Cargo10_military_green_F",[-13.6812,6.63672,0],90,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[12.9861,-8.80762,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[12.9617,9.55908,0],180,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[16.4038,-1.53125,0],270,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[16.4004,2.30566,0],270,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-13.9082,-8.84131,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-13.938,9.54785,0],180,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[16.3984,-5.36816,0],270,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-17.3528,-1.5874,0],90,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-17.3486,2.25781,0],90,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[16.3979,6.1416,0],270,1,0,[],"","",true,false], 
["Land_LampHalogen_F",[14.9805,8.17041,0],315,1,0,[],"","",true,false], 
["Land_Mil_WallBig_Corner_F",[16.4526,-8.84131,0],270,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-17.3528,-5.43066,0],90,1,0,[],"","",true,false], 
["Land_LampHalogen_F",[-15.968,8.13623,0],225,1,0,[],"","",true,false], 
["Land_Mil_WallBig_4m_F",[-17.3477,6.10547,0],90,1,0,[],"","",true,false], 
["Land_Mil_WallBig_Corner_F",[16.4351,9.6084,0],180,1,0,[],"","",true,false], 
["Land_Mil_WallBig_Corner_F",[-17.3838,-8.90137,0],0,1,0,[],"","",true,false], 
["Land_Mil_WallBig_Corner_F",[-17.406,9.5791,0],90,1,0,[],"","",true,false]
];

_objs

Spawn code:

deleteVehicle this; 0 = [position this, 0, call (compile (preprocessFileLineNumbers "structures\NATO_outpost01.sqf"))] call BIS_fnc_ObjectsMapper;

With kind regards,

StayFrosty24

Share this post


Link to post
Share on other sites

I used your composition and after a little playing around with various ways of doing it.

I thought the precompile was unecessary, but it proved it had to be done or nothing would spawn.

Only error I got was in line 33 of your composition, i think you have a comma instead of decimal point for the setHeight func. And the talbe does not seems to stand corectly but that could be the Z height bug that was noted previously in this thread.

This is a strange one as the function checks the file name is a script and precompiles it

(if (!isNil "_script") then {    _objs = call (compile (preprocessFileLineNumbers _script));};)

I tried a number of ways and found this way is the only one of two where it works. The other is pasting the object array directly into the command, but thats a lot of info and makes it very difficult to make sure brackets are completely wrapped correctly.

http://i.imgur.com/OwQOida.png (513 kB)

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites

Yeah i noticed the error after the previous post.

But the problem i meant is inside this code

["SignAd_Sponsor_ARMEX_F",[9.15869,-9.41406,0],0,1,0,[],"","this setObjectTexture [0,'A3\Data_F\Flags\Flag_us_co.paa'];",true,false], 

In front of the outpost is a Sign with ARMEX on it.

This code must add a us flag texture as overlay. But it when i preview the mission it doesn't spawn the texture on the sign.

Regards,

Frosty

Share this post


Link to post
Share on other sites

sorry i misunderstood the texture issue.
Tried it in editor and that works. OK. hmm.....

I played around a bit and dug into the code - name the sign object and it seems to work. replace line 30 of composition with this.

["SignAd_Sponsor_ARMEX_F",[9.15869,-9.41406,0],0,1,0,[],"sign","sign setObjectTextureGlobal [0,'A3\Data_F\Flags\Flag_us_co.paa'];",true,false],

http://i.imgur.com/UoRHspN.png

Share this post


Link to post
Share on other sites

having a few problems spawning these realistically if anyone can help.

 

I've got fairly decent spawning locations with SHKpos and the main building I spawn I make sure the vector is up e.g.

["Land_d_Stone_HouseSmall_V1_F",[-2.48828,13.3594,2.09808e-005],0,1,0,[],"","this setVectorUp [0,0,1];",true,false],

But its things like sandbags that all go a bit tits up. Any way to refine it?

 

Cheers.

Share this post


Link to post
Share on other sites

Its been a while since I have cracked the Arma sediting or scripting, but i am pretty sure the objectgrabber takes care of vecotup values you should not have to do it yourself.

Have you tested without that in the line to see what happens?

 

Try similar to above for the sign 'name' the object and run command vectorup on that. e.g.

["Land_d_Stone_HouseSmall_V1_F",[-2.48828,13.3594,2.09808e-005],0,1,0,[],"smHouse","smHouse setVectorUp [0,0,1];",true,false]

Share this post


Link to post
Share on other sites

I used Zeus to spawn a guer camp at the airport and then grabbed that. When it all spawns randomly via Shk pos everything is mapped to the gradient of the land so my unit usually gets a table to the face :)

Both vectorup solutions work great for buildings. Its the rest of it, ill post some screens when I get a chance, its hard to explain.

Share this post


Link to post
Share on other sites

If you use the third param whilst making your composition with objectGrabber it will save each objects pitch and bank aswell.

/*

File: objectGrabber.sqf

Author: Joris-Jan van 't Land

Description:

Converts a set of placed objects to an object array for the DynO mapper.

Places this information in the debug output for processing.

Parameter(s):

_this select 0: position of the anchor point (Array)

_this select 1: size of the covered area (Scalar)

_this select 2: grab object orientation? (Boolean) [default: false]

Returns:

Ouput text (String)

*/

Share this post


Link to post
Share on other sites

Here is what I mean in the piccy below.

 

I could probably do with tweaking my SHKpos call to not pick such heavy gradients but I'm not sure how at the moment. (Heli is a chinook which is pretty big).

call compile preprocessfile "SHK_pos\shk_pos_init.sqf";


_startT4Pos = [shkOne,[0,3500],random 360,0,[0],[500,heli]] call SHK_pos;


_t4marker = createMarker ["t4marker1",_startT4Pos];
_t4marker setMarkerShape "ELLIPSE";
_t4marker setMarkerColor "ColorOPFOR";
_t4marker setMarkerSize [500, 500];
_t4marker setMarkerBrush "DiagGrid";

 

khOIEj0.jpg

 

iLwvynf.jpg

Share this post


Link to post
Share on other sites

Ok so i'm getting somewhere by using isFlatEmpty but it sends my PC mental for 30 seconds at the start of the mission looking for a spot.

 

I'm assuming I've got the values a little out as I don't fully understand them. AO is a 5k marker on the west of altis (quite hilly) heli is an empty Huron. house1 is a house of the same type in above pics.

 

call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; 
_pos = ["AO", 0,[],[500,heli]] call SHK_pos; //searches all over the 5k AO Marker, no water, [empty blacklist marrker array], [finds a spot with 500m, of the pos that will fit a Churon?]
_startT4Pos = _pos isFlatEmpty[5, 1, 0.7, 5, 0, false, house1]; //Check new _pos is not with 5m of anything, not 100% sure what this does, 0.7 gradient?, not 100% sure what this does, no water, no water?
while {(count _startT4Pos) < 1} do { //Loop if it cant find a spot
_pos = ["AO", 0,[],[500,heli]] call SHK_pos;
_startT4Pos = _pos isFlatEmpty[20, 1, 0.3, 40, 0, false, house1];
};

Any help greatly appreciated :)

Share this post


Link to post
Share on other sites

So if you want objects to go by the gradient of the ground below them you have two options:

"this setPosATL [getPosATL this select 0, getPosATL this select 1, 0]; this setVectorUp surfaceNormal position this"

Place this individually to every objects eight array point.

 

Or if you want all objects to do it:

{
_x set [7, "this setPosATL [getPosATL this select 0, getPosATL this select 1, 0]; this setVectorUp surfaceNormal position this"];
} forEach _base;

or

{
_x setPosATL [getPosATL _x select 0, getPosATL _x select 1, 0];
_x setVectorUp surfaceNormal position _x];
} forEach _baseObjects;

_base is the list that you make with the ObjectsGrabber and _baseObjects =  [---, ---, ---] call BIS_fnc_ObjectsMapper.

Share this post


Link to post
Share on other sites

Thanks kauppapekka, that's very useful. 

 

Generally it's only buildings that need the adjustment, everything else falls into place nicely with careful use of isFlatEmpty ir the safePos function.

Share this post


Link to post
Share on other sites
On 4/9/2014 at 4:05 PM, shay_gman said:

There is a custom DOC placer and grabber generator in the 3d editor under the > button. As far as I remember the Z factor is fixed there. So if you can check it out and post your resualts if it is broken i'll fix it and release it for the community

Hi,

I tried to find this but I was unable to do so, do you know if this is still in the current version of Arma 3?

 

The issue I'm encountering is that when I spawn my composition alot of the objects are at the wrong height.


Here is what it should look like (and what it looks like when I use the grabber)

c76ee8269d22d71f87669c7a874edffe.jpg

 

Here is what it ends up looking like when spawned with object mapper

491e3bd3e14886ccbcfe0f7b95f1b1e4.jpg

If anyone knows a way to fix this any help would be appreciated.

Thank You.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×