setVehiclePosition: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (example) |
Killzone Kid (talk | contribs) mNo edit summary |
||
Line 39: | Line 39: | ||
_cam [[setDir]] [[random]] 360; | _cam [[setDir]] [[random]] 360; | ||
_cam [[setVehiclePosition]] <nowiki>[</nowiki>[5000,5000], [], 1000, "NONE"]; | _cam [[setVehiclePosition]] <nowiki>[</nowiki>[5000,5000], [], 1000, "NONE"]; | ||
_cam [[setPosWorld]] ([[getPosWorld]] _cam [[vectorAdd]] [0,0, | _cam [[setPosWorld]] ([[getPosWorld]] _cam [[vectorAdd]] [0,0,1.8]); | ||
_cam [[cameraEffect]] ["Internal", "Back"];</code>|= Example 2 | _cam [[cameraEffect]] ["Internal", "Back"];</code>|= Example 2 | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ |
Revision as of 16:57, 24 June 2015
Description
- Description:
- Moves the object to a given position (same as createVehicle placement algorithm). Uses either the position that's defined by the position param, or one of the marker positions from the markers array. The object is placed inside a circle with position as its center and placement as its radius. The type of placement could also be controlled with special.
If position is in water and vehicle can float, it is placed on water surface, otherwise it is placed on the ground, even if ground is under water. If roof surfaces support walking, units will be placed on roofs if such position is given. - Groups:
- Uncategorised
Syntax
- Syntax:
- object setVehiclePosition [position, markers, placement, special]
- Parameters:
- object: Object
- [position, markers, placement, special]: Array
- position: Position, Position2D or Object - Desired placement position. If object is given, object position is used for position. In any case, only x and y are considered.
- markers: Array - If the markers array contains several marker names, the position of a random one is used. Otherwise, the given position is used.
- placement: Number - The vehicle is randomly placed inside a circle with given position as center and placement as its radius
- special (Optional): String - Could be one of the following:
- "NONE" - will look for suitable empty position near given position (subject to other placement params) before placing vehicle there.
- "CAN_COLLIDE" places vehicle at given position (subject to other placement params), without checking if others objects can cross its 3D model.
- "FLY" - if vehicle is capable of flying and has crew, it will be made airborne at default height.
- Return Value:
- Boolean - true on success, false on failure
Examples
- Example 1:
player setVehiclePosition [[1000,2000], ["Pos1","Pos2","Pos3"], 0, "CAN_COLLIDE"];
Will place the player at either [1000,2000], or one of the three markers positions.- Example 2:
heli setVehiclePosition [player, [], 0, "FLY"];
- Example 3:
_cam = "camera" camCreate [0,0,0]; _cam setDir random 360; _cam setVehiclePosition [[5000,5000], [], 1000, "NONE"]; _cam setPosWorld (getPosWorld _cam vectorAdd [0,0,1.8]); _cam cameraEffect ["Internal", "Back"];
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
Bottom Section
- Posted on June 24, 2015 - 15:43 (UTC)
- Killzone Kid
-
If you need to set direction as well, set it before using setVehiclePosition. The command will use existing dir of the object for its calculations.
player setDir random 360; player setVehiclePosition [player, [], 100, "none"];