setDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
Line 21: Line 21:
| [[Nothing]] |= Return value
| [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
|x1 = <code> _soldier1 '''setDir''' 45 </code>
|x1 = <code> _soldier1 [[setDir]] 45 </code>
Will set soldier1 to face North East
Will set soldier1 to face North East
|x2 = <code>_soldier1 '''setDir''' -675</code>
|x2 = <code>_soldier1 [[setDir]] -675</code>
Will also set soldier1 to face North East
Will also set soldier1 to face North East


| [[getDir]], [[setFormDir]] |= See also
| [[getDir]], [[direction]], [[setFormDir]] |= See also


}}
}}
Line 60: Line 60:
In ArmA 2 OA, this command only makes the unit glance momentarily to the direction. To change his heading more permanently use [[setFormDir]].
In ArmA 2 OA, this command only makes the unit glance momentarily to the direction. To change his heading more permanently use [[setFormDir]].


<dd class="notedate">Posted on August 28, 2013
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
<dd class="note">
Be careful letting the command to do the conversion for you when the angle is < 0 or > 360
<code>[[player]] [[setDir]] 360+1;
[[hint]] [[str]] [[direction]] [[player]]; //1
[[player]] [[setDir]] -360+1;
[[hint]] [[str]] [[direction]] [[player]]; //1.00001
[[player]] [[setDir]] 360*5+1;
[[hint]] [[str]] [[direction]] [[player]]; //1.00002
[[player]] [[setDir]] -360*5+1;
[[hint]] [[str]] [[direction]] [[player]]; //0.999972
[[player]] [[setDir]] 360*10+1;
[[hint]] [[str]] [[direction]] [[player]]; //0.999876
[[player]] [[setDir]] -360*10+1;
[[hint]] [[str]] [[direction]] [[player]]; //1
[[player]] [[setDir]] 360*100000+1;
[[hint]] [[str]] [[direction]] [[player]]; //358.24
[[player]] [[setDir]] -360*100000+1;
[[hint]] [[str]] [[direction]] [[player]]; //1.76001
[[player]] [[setDir]] 360*10000000+1;
[[hint]] [[str]] [[direction]] [[player]]; //298.591
[[player]] [[setDir]] -360*10000000+1;
[[hint]] [[str]] [[direction]] [[player]]; //61.4094</code>


<!-- Note Section END -->
<!-- Note Section END -->

Revision as of 19:23, 28 August 2013

Hover & click on the images for description

Description

Description:
Sets object heading. Angles are measured in degrees clockwise from north. The accepted heading range is from 0 to 360 Negative angles represent a counter-clockwise angle and the angle can be of any size.
Groups:
Uncategorised

Syntax

Syntax:
object setDir heading
Parameters:
object: Object
heading: Number
Return Value:
Nothing

Examples

Example 1:
_soldier1 setDir 45 Will set soldier1 to face North East
Example 2:
_soldier1 setDir -675 Will also set soldier1 to face North East

Additional Information

See also:
getDirdirectionsetFormDir

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

Posted on May 9, 2007 - 20:43 CET
Manny
Though effects of this command remain local, you can do a setPos afterwards to synchronize the direction on all machines in MP. myObj setDir 90; myObj setPos getPos myObj;
Posted on January 9, 2009 - 22:21
Killswitch
In ArmA, the effect of setDir is synchronized across the network.
Posted on April 5th, 2011
kju
In OA 1.59 the comment of Manny still holds true for createVehicle'd empty vehicles by the server. For the player object a local setDir alone is enough.
Posted on July 10, 2010 - 16:34
Shuko
In ArmA 2 OA, this command only makes the unit glance momentarily to the direction. To change his heading more permanently use setFormDir.
Posted on August 28, 2013
Killzone_Kid
Be careful letting the command to do the conversion for you when the angle is < 0 or > 360 player setDir 360+1; hint str direction player; //1 player setDir -360+1; hint str direction player; //1.00001 player setDir 360*5+1; hint str direction player; //1.00002 player setDir -360*5+1; hint str direction player; //0.999972 player setDir 360*10+1; hint str direction player; //0.999876 player setDir -360*10+1; hint str direction player; //1 player setDir 360*100000+1; hint str direction player; //358.24 player setDir -360*100000+1; hint str direction player; //1.76001 player setDir 360*10000000+1; hint str direction player; //298.591 player setDir -360*10000000+1; hint str direction player; //61.4094

Bottom Section