Jump to content
General McTavish

Create Vehicle Position help

Recommended Posts

Hey all

 

I am helping to build a ramp/obstacle course and having difficulty working out how to set the objects on the Z Index

 

I can spawn them fine, however, they spawn at all ground level

 

Not sure on how to correctly pull the position so they create correctly in the air

 

Any help would be great

 

Code:

Spoiler

private _courseObjects = 

[

    ["Land_VR_Block_01_F",[24167,18776.9,15.4802],152.067],

    ["Land_VR_Slope_01_F",[24171.4,18762.8,23.214],152.93],

    ["Land_VR_Slope_01_F",[24175.9,18765.1,23.214],152.93],

    ["Land_VR_Slope_01_F",[24175.9,18754.1,27.0299],152.93],

    ["Land_VR_Block_02_F",[24168.2,18766.8,62.2574],0],

    ["Land_VR_Block_02_F",[24178.9,18766.8,62.2577],270.136],

    ["Land_CrashBarrier_01_8m_F",[24167.8,18761.1,66.7944],0],

    ["Land_CrashBarrier_01_8m_F",[24168.1,18772.8,66.7944],180.285],

    ["Land_CrashBarrier_01_8m_F",[24175.8,18761.1,66.7947],0],

    ["Land_CrashBarrier_01_8m_F",[24162.4,18766.8,66.7944],90.28],

    ["Land_CrashBarrier_01_8m_F",[24175.7,18772.7,66.7947],180.285],

    ["Land_VR_Block_01_F",[24168.4,18788.3,15.4802],90.5037],

    ["Land_VR_Block_01_F",[24208.4,18742,0],270.936],

    ["Land_VR_Block_01_F",[24186.1,18741.7,23.019],90.5037],

    ["Land_VR_Slope_01_F",[24200.6,18744.1,30.7528],89.7011],

    ["Land_VR_Slope_01_F",[24200.7,18739.1,30.7528],89.7011],

    ["Land_FinishGate_01_wide_F",[24180.9,18766.7,66.5653],271.274],

    ["Land_VR_Slope_01_F",[24201.3,18768.2,0],180.766],

    ["Land_VR_Slope_01_F",[24180.4,18756.5,27.0299],152.93],

    ["Land_VR_Slope_01_F",[24196.4,18766.9,62.1724],268.687],

    ["Land_VR_Slope_01_F",[24205.9,18767.4,58.4897],268.687],

    ["Land_VR_Slope_01_F",[24206.3,18768.1,0],180.766],

    ["Land_VR_Slope_01_F",[24206.2,18758.4,3.8159],180.766],

    ["Land_VR_Slope_01_F",[24201.2,18758.5,3.8159],180.766],

    ["Land_VR_Block_02_F",[24185.5,18758.3,62.2079],0],

    ["Land_VR_Block_02_F",[24185.5,18775.2,62.2021],0],

    ["Land_VR_Slope_01_F",[24182.9,18790.7,23.214],89.7011],

    ["Land_VR_Slope_01_F",[24182.9,18785.8,23.214],89.7011],

    ["Land_VR_Slope_01_F",[24192.6,18785.9,27.0299],89.7011],

    ["Land_VR_Slope_01_F",[24192.6,18790.8,27.0299],89.7011],

    ["Land_VR_Slope_01_F",[24223.3,18744.1,7.89413],91.1045],

    ["Land_VR_Slope_01_F",[24233,18744,11.71],91.1045],

    ["Land_VR_Slope_01_F",[24223.2,18739.1,7.89413],91.1045],

    ["Land_VR_Slope_01_F",[24232.9,18739,11.71],91.1045],

    ["Land_VR_Slope_01_F",[24219.3,18744.3,38.096],90.4784],

    ["Land_VR_Slope_01_F",[24210.4,18739.2,34.5687],89.7011],

    ["Land_VR_Slope_01_F",[24219.3,18739.3,38.096],90.4784],

    ["Land_VR_Slope_01_F",[24210.4,18744.2,34.5687],89.7011],

    ["Land_VR_Slope_01_F",[24229.1,18744.2,41.9119],90.4784],

    ["Land_VR_Slope_01_F",[24229,18739.2,41.9119],90.4784],

    ["Land_VR_Slope_01_F",[24238.4,18744.2,45.5115],90.4784],

    ["Land_VR_Slope_01_F",[24238.3,18739.3,45.4904],90.4784],

    ["Land_VR_Slope_01_F",[24224,18770.6,55.1612],88.2144],

    ["Land_VR_Slope_01_F",[24216.1,18758.2,3.8159],180.766],

    ["Land_VR_Slope_01_F",[24233.9,18770.8,55.1612],268.781],

    ["Land_VR_Slope_01_F",[24211.2,18768,0],180.766],

    ["Land_VR_Slope_01_F",[24234.1,18765.8,55.1612],268.781],

    ["Land_VR_Slope_01_F",[24211.1,18758.3,3.8159],180.766],

    ["Land_VR_Slope_01_F",[24224.2,18765.6,55.1612],88.2144],

    ["Land_VR_Slope_01_F",[24216.2,18767.9,0],180.766],

    ["Land_VR_Slope_01_F",[24215.2,18767.7,54.9513],268.687],

    ["Land_VR_Slope_01_F",[24230.1,18785.8,23.214],270.407],

    ["Land_VR_Slope_01_F",[24220.4,18785.8,27.0299],270.407],

    ["Land_VR_Slope_01_F",[24230.1,18790.8,23.214],270.407],

    ["Land_VR_Slope_01_F",[24220.6,18790.7,26.9065],270.407],

    ["Land_VR_Block_01_F",[24249.1,18745.8,7.58477],1.21541],

    ["Land_VR_Slope_01_F",[24247.9,18744.3,49.2771],90.4784],

    ["Land_VR_Slope_01_F",[24247.9,18739.3,49.2552],90.4784],

    ["Land_VR_Block_04_F",[24263.2,18741.8,44.4209],0],

    ["Land_VR_Slope_01_F",[24251.9,18770,19.1345],0.412835],

    ["Land_VR_Slope_01_F",[24246.9,18770,19.1345],0.412835],

    ["Land_VR_Slope_01_F",[24260.9,18751.6,53.1683],0.50569],

    ["Land_VR_Slope_01_F",[24251.8,18760.3,15.3186],0.412835],

    ["Land_VR_Slope_01_F",[24265.8,18751.5,53.1465],0.50569],

    ["Land_VR_Slope_01_F",[24253.4,18765.9,56.6777],269.874],

    ["Land_VR_Slope_01_F",[24246.9,18760.3,15.3186],0.412835],

    ["Land_VR_Slope_01_F",[24253.3,18770.9,56.6777],269.874],

    ["Land_VR_Slope_01_F",[24243.6,18770.8,55.1414],90.2668],

    ["Land_VR_Slope_01_F",[24243.6,18766,55.147],90.7698],

    ["Land_VR_Block_04_F",[24263.1,18768.2,47.9845],0],

    ["Land_VR_Block_01_F",[24244.6,18788.1,15.4802],271.209]

];


 

{

    _objectClass = _x select 0;

    _objectPosition = _x select 1;

    _objectDirection = _x select 2;

    

    private _objectClass = (_x select 0) createVehicle _objectPosition;


 

} forEach _courseObjects;

 

Share this post


Link to post
Share on other sites

Your code spoiler might be empty. Could also just be my phone. But I can't see anything in the spoiler. 

 

Edit: Yep, you're missing your code example.

Share this post


Link to post
Share on other sites

Test 1:

Place a box on the map. Right click on the box and take a note of its X,Y and Z coordinates.

Now place the box somewhere else and place a trigger on the map.

In the trigger, write a command so that the box is transported to those coordinates

Test that when the trigger fires, the box moves to the correct coordinates.

 

Test 2:

This time, place a box on the map and use the mouse so that the box is well above the ground level.  Take a note of its X,Y and Z coordinates

Now place the box somewhere else, at ground level, and place a trigger on the map.

In the trigger, write a command so that the box is transported to those coordinates

Test that when the trigger fires, the box moves to the correct coordinates. The problem is that, when the mission starts, gravity will takeover and the box will fall to the ground.

 

 

 

Share this post


Link to post
Share on other sites

 

7 hours ago, beno_83au said:

Your code spoiler might be empty. Could also just be my phone. But I can't see anything in the spoiler. 

 

Edit: Yep, you're missing your code example.

 

Woops, fixed 😄

Share this post


Link to post
Share on other sites

You can't spawn an object in the air, static, without disabling its simulation.

{
    params ["_objectClass","_objectPosition", "_objectDirection"];
    _object = _objectClass createVehicle _objectPosition;
    _object setdir _objectDirection;
    _object enableSimulationGlobal FALSE;
} forEach _courseObjects;

EDITED: See below.

Share this post


Link to post
Share on other sites
19 hours ago, pierremgi said:

You can't spawn an object in the air, static, without disabling its simulation.


{
    params ["_objectClass","_objectPosition", "_objectDirection"];
    _object = _objectClass createVehicle _objectPosition;
    _object setdir _objectDirection;
    _object enableSimulationGlobal FALSE;
} forEach _courseObjects;

 

 

Thanks for the reply, I totally forgot about simulation

 

I tried your code and it won't spawn anything at all now.

Share this post


Link to post
Share on other sites
1 hour ago, General McTavish said:

 

Thanks for the reply, I totally forgot about simulation

 

I tried your code and it won't spawn anything at all now.

Depending on what is your final code. There is no reason to fail if the local variables are defined...

 

EDITED: my bad! I forgot to refer to _x in forEach loop. And you must use the alternate syntax of createVehicle:

 

0 = [] spawn {
 private _courseObjects =  
 [
 ["Land_VR_Block_01_F",[24167,18776.9,15.4802],152.067],
 ["Land_VR_Slope_01_F",[24171.4,18762.8,23.214],152.93],
 ["Land_VR_Slope_01_F",[24175.9,18765.1,23.214],152.93],
 ["Land_VR_Slope_01_F",[24175.9,18754.1,27.0299],152.93],
 ["Land_VR_Block_02_F",[24168.2,18766.8,62.2574],0],
 ["Land_VR_Block_02_F",[24178.9,18766.8,62.2577],270.136],
 ["Land_CrashBarrier_01_8m_F",[24167.8,18761.1,66.7944],0],
 ["Land_CrashBarrier_01_8m_F",[24168.1,18772.8,66.7944],180.285],
 ["Land_CrashBarrier_01_8m_F",[24175.8,18761.1,66.7947],0],
 ["Land_CrashBarrier_01_8m_F",[24162.4,18766.8,66.7944],90.28],
 ["Land_CrashBarrier_01_8m_F",[24175.7,18772.7,66.7947],180.285],
 ["Land_VR_Block_01_F",[24168.4,18788.3,15.4802],90.5037],
 ["Land_VR_Block_01_F",[24208.4,18742,0],270.936],
 ["Land_VR_Block_01_F",[24186.1,18741.7,23.019],90.5037],
 ["Land_VR_Slope_01_F",[24200.6,18744.1,30.7528],89.7011],
 ["Land_VR_Slope_01_F",[24200.7,18739.1,30.7528],89.7011],
 ["Land_FinishGate_01_wide_F",[24180.9,18766.7,66.5653],271.274],
 ["Land_VR_Slope_01_F",[24201.3,18768.2,0],180.766],
 ["Land_VR_Slope_01_F",[24180.4,18756.5,27.0299],152.93],
 ["Land_VR_Slope_01_F",[24196.4,18766.9,62.1724],268.687],
 ["Land_VR_Slope_01_F",[24205.9,18767.4,58.4897],268.687],
 ["Land_VR_Slope_01_F",[24206.3,18768.1,0],180.766],
 ["Land_VR_Slope_01_F",[24206.2,18758.4,3.8159],180.766],
 ["Land_VR_Slope_01_F",[24201.2,18758.5,3.8159],180.766],
 ["Land_VR_Block_02_F",[24185.5,18758.3,62.2079],0],
 ["Land_VR_Block_02_F",[24185.5,18775.2,62.2021],0],
 ["Land_VR_Slope_01_F",[24182.9,18790.7,23.214],89.7011],
 ["Land_VR_Slope_01_F",[24182.9,18785.8,23.214],89.7011],
 ["Land_VR_Slope_01_F",[24192.6,18785.9,27.0299],89.7011],
 ["Land_VR_Slope_01_F",[24192.6,18790.8,27.0299],89.7011],
 ["Land_VR_Slope_01_F",[24223.3,18744.1,7.89413],91.1045],
 ["Land_VR_Slope_01_F",[24233,18744,11.71],91.1045],
 ["Land_VR_Slope_01_F",[24223.2,18739.1,7.89413],91.1045],
 ["Land_VR_Slope_01_F",[24232.9,18739,11.71],91.1045],
 ["Land_VR_Slope_01_F",[24219.3,18744.3,38.096],90.4784],
 ["Land_VR_Slope_01_F",[24210.4,18739.2,34.5687],89.7011],
 ["Land_VR_Slope_01_F",[24219.3,18739.3,38.096],90.4784],
 ["Land_VR_Slope_01_F",[24210.4,18744.2,34.5687],89.7011],
 ["Land_VR_Slope_01_F",[24229.1,18744.2,41.9119],90.4784],
 ["Land_VR_Slope_01_F",[24229,18739.2,41.9119],90.4784],
 ["Land_VR_Slope_01_F",[24238.4,18744.2,45.5115],90.4784],
 ["Land_VR_Slope_01_F",[24238.3,18739.3,45.4904],90.4784],
 ["Land_VR_Slope_01_F",[24224,18770.6,55.1612],88.2144],
 ["Land_VR_Slope_01_F",[24216.1,18758.2,3.8159],180.766],
 ["Land_VR_Slope_01_F",[24233.9,18770.8,55.1612],268.781],
 ["Land_VR_Slope_01_F",[24211.2,18768,0],180.766],
 ["Land_VR_Slope_01_F",[24234.1,18765.8,55.1612],268.781],
 ["Land_VR_Slope_01_F",[24211.1,18758.3,3.8159],180.766],
 ["Land_VR_Slope_01_F",[24224.2,18765.6,55.1612],88.2144],
 ["Land_VR_Slope_01_F",[24216.2,18767.9,0],180.766],
 ["Land_VR_Slope_01_F",[24215.2,18767.7,54.9513],268.687],
 ["Land_VR_Slope_01_F",[24230.1,18785.8,23.214],270.407],
 ["Land_VR_Slope_01_F",[24220.4,18785.8,27.0299],270.407],
 ["Land_VR_Slope_01_F",[24230.1,18790.8,23.214],270.407],
 ["Land_VR_Slope_01_F",[24220.6,18790.7,26.9065],270.407],
 ["Land_VR_Block_01_F",[24249.1,18745.8,7.58477],1.21541],
 ["Land_VR_Slope_01_F",[24247.9,18744.3,49.2771],90.4784],
 ["Land_VR_Slope_01_F",[24247.9,18739.3,49.2552],90.4784],
 ["Land_VR_Block_04_F",[24263.2,18741.8,44.4209],0],
 ["Land_VR_Slope_01_F",[24251.9,18770,19.1345],0.412835],
 ["Land_VR_Slope_01_F",[24246.9,18770,19.1345],0.412835],
 ["Land_VR_Slope_01_F",[24260.9,18751.6,53.1683],0.50569],
 ["Land_VR_Slope_01_F",[24251.8,18760.3,15.3186],0.412835],
 ["Land_VR_Slope_01_F",[24265.8,18751.5,53.1465],0.50569],
 ["Land_VR_Slope_01_F",[24253.4,18765.9,56.6777],269.874],
 ["Land_VR_Slope_01_F",[24246.9,18760.3,15.3186],0.412835],
 ["Land_VR_Slope_01_F",[24253.3,18770.9,56.6777],269.874],
 ["Land_VR_Slope_01_F",[24243.6,18770.8,55.1414],90.2668],
 ["Land_VR_Slope_01_F",[24243.6,18766,55.147],90.7698],
 ["Land_VR_Block_04_F",[24263.1,18768.2,47.9845],0],
 ["Land_VR_Block_01_F",[24244.6,18788.1,15.4802],271.209] ];
 {
    _x params ["_objectClass","_objectPosition", "_objectDirection"];
    _object = createVehicle [_objectClass,_objectPosition,[], 0, "can_collide"];
    _object setdir _objectDirection;
    _object enableSimulationGlobal FALSE;
} forEach _courseObjects;
};

With this syntax and these objects, the simulation line is not mandatory.

  • Like 1

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

×