Basically we are talking about spawning an object (a section of a bridge) and then repeating it n times moving it further with each iteration. Or maybe attaching newly spawned section to a base increasing offset with each iteration. There is of course a 3rd method, placing each section in the editor manually. Good luck with that.

My preferred method would be to attach sections with attachTo. However in ArmA 3 attached objects appear to have no collision with vehicles unlike in ArmA 2. So if you build a bridge and then drive over it, after you pass the base section of the bridge you will just dive through the next section. On the other hand, attached objects in ArmA 3 will correctly report their current attached position and direction, whereas in ArmA 2 they won’t. To work around attachment problem in ArmA 3 you can take position of attached section, detach it and then move it back into position, then everything works out nicely.

The bridge in the above video was pretty straight forward job. However a foot bridge for example might need some sideways adjustments to align all sections properly.

I’ve constructed this little function that would repeat given object with given parameters. The parameters are:

  • [startingPosition, direction, objectClass, repeats, offsetX, offsetY, offsetZ]

ArmA 3 variant

fnc_bridgeA3 = { private ["_start","_obj","_objPos","_objDir"]; _start = createVehicle [ _this select 2, _this select 0, [], 0, "CAN_COLLIDE" ]; _start setVectorUp [0,0,1]; _start setDir (_this select 1); _start setPosATL (_this select 0); for "_i" from 1 to (_this select 3) do { _obj = createVehicle [ _this select 2, _this select 0, [], 0, "CAN_COLLIDE" ]; _obj attachTo [_start, [ _i*(_this select 4), _i*(_this select 5), _i*(_this select 6) ]]; _objPos = getPosATL _obj; _objDir = getDir _obj; detach _obj; _obj setDir _objDir; _obj setPosATL _objPos; }; };

ArmA 2 variant

fnc_bridgeA2 = { private ["_start","_obj"]; _start = createVehicle [ _this select 2, _this select 0, [], 0, "CAN_COLLIDE" ]; _start setVectorUp [0,0,1]; _start setDir (_this select 1); _start setPosATL (_this select 0); for "_i" from 1 to (_this select 3) do { _obj = createVehicle [ _this select 2, _this select 0, [], 0, "CAN_COLLIDE" ]; _obj attachTo [_start, [ _i*(_this select 4), _i*(_this select 5), _i*(_this select 6) ]]; }; };

You can find examples of usage on the next page.

Pages: 1 2