setVehiclePosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<dl class="command_description"> <dt></dt>" to "<dl class="command_description"> <dt></dt>")
m (Text replacement - "\| arma1 \|1.00 \|([^g]|g[^a])" to "| ofpe | 1.00 |game2= arma1 |version2= 1.00 |game3= arma2 |version3= 1.00 |game4= arma2oa |version4= 1.50 |game5= tkoh |version5= 1.00 |game6= arma3 |version6= 0.50 |$1")
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| arma1
| ofpe
| 1.00


|1.00
|game2= arma1
|version2= 1.00
 
|game3= arma2
|version3= 1.00
 
|game4= arma2oa
|version4= 1.50
 
|game5= tkoh
|version5= 1.00
 
|game6= arma3
|version6= 0.50


|arg= global
|arg= global

Revision as of 23:07, 12 June 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
PositionsObject Manipulation

Syntax

Syntax:
Syntax needed
Parameters:
object: Object
[position, markers, placement, special]: Array
position: PositionATL (PositionAGL if boat or amphibious), Position2D, or Object - Desired placement position. If object is given, object position is used for position. Normally only x and y are considered, unless "CAN_COLLIDE" is used for special placement.
markers: Array of Strings - If the markers array contains one or more marker names, the position is chosen randomly and could be one of the marker positions or just the supplied main position. If marker had z coordinate set with setMarkerPos, the vehicle will be placed on the nearest surface below this z coordinate
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.
If special is "" or not specified, default "NONE" is used.
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"];
Example 4:
private _tablePos = player getRelPos [3, 0]; private _table = "Land_CampingTable_F" createVehicle [0,0,0]; private _laptop = "Land_Laptop_unfolded_F" createVehicle [0,0,0]; _table setPos _tablePos; _laptop setVehiclePosition [_tablePos vectorAdd [0.5, 0.2, 10], [], 0, "CAN_COLLIDE"]; _laptop attachTo [_table];

Additional Information

See also:
See also needed

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
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"];