Jump to navigation Jump to search
- Sets object heading. Angles are measured in degrees clockwise from north; the regular range goes from 0 to 360 (0° = N, 90° = E, 180° = S, 270° = W). Negative angles represent counter-clockwise angles.
- See the Notes below
- Object Manipulation
- Example 1:
- myUnit setDir 45; // will set myUnit to face North-East
- Example 2:
- myUnit setDir -675; // will also set myUnit to face North-East (= 45-360-360)
- Example 3:
- Example 4:
- Posted on May 09, 2007 - 20:43 (UTC)
Though effects of this command remain local, you can do a setPos afterwards to synchronize the direction on all machines in MP.
- Posted on Apr 05, 2001 - 10:54 (UTC)
- In Arma 2: Operation Arrowhead 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 Nov 25, 2013 - 11:47 (UTC)
- In Arma 3, setDir affects vectorUp, vectorDir and velocity of the object it applied to. While this is not noticeable with stationary objects, a moving objects will have its orientation and velocity reset. So if you are planning on using setDir on a moving object, make sure you read the velocity value before and restore it after if you want the object to continue to move. setDir resets vectorUp to [0,0,1] and changes vectorDir accordingly to accommodate set direction. If your object's vectorUp is not [0,0,1] and you want to keep it this way, then you have to use setVectorDirAndUp to change object's direction not setDir. This is also the reason why it is better to use setVectorDirAndUp instead of setDir on attached objects for a better control of object's orientation.
- Posted on Nov 27, 2013 - 23:09 (UTC)
- Make sure you setDir BEFORE you set position. Setting direction after set position could lead to unpredictable behaviour. For example main part of the hospital building in Arma 3 can lose collision detection near both side entrances. AI will also get confused and will stop detecting obstacles if setDir is called after setPos.