By-Jokese 3 Posted February 26, 2018 I have coded this simple scripts, that should place an object (var name "_object"), 1 meter away from the player in the same direction he is facing. _pos = getPosATL _unit; _azimuth = getDir _unit; _far = 1; //Distance from the player to the _object _x = (_pos select 0) + (_far * (cos _azimuth)); _y = (_pos select 1) + (_far * (sin _azimuth)); _obj = createVehicle [_object, [_x, _y, (_pos select 2)], [], 0, 'CAN_COLLIDE']; I have used that technique on many other sites, but cant make it work in Arma... The object keeps spawning where it wants.... (Not random location but depending where you are facing it has 2-3 different locations where it spawns)... Can any help? Share this post Link to post Share on other sites
mrcurry 496 Posted February 26, 2018 All directions used ingame works of compass direction (0 = North, 90=east) which is not technically mathematically "correct". Switching sin and cos around in your code should do it. There are multiple commands to help with this conversion, such as getPos (see alternative syntax) Share this post Link to post Share on other sites
By-Jokese 3 Posted February 26, 2018 Swapping Cos and Sin did work. Arma always surprises me.... Share this post Link to post Share on other sites
rübe 127 Posted February 26, 2018 @By-Jokese Check out: https://community.bistudio.com/wiki/modelToWorld and then a position a meter in front of the player just boils down to: _pos = player modelToWorld [0,1,0]; Share this post Link to post Share on other sites
By-Jokese 3 Posted February 26, 2018 That's also interesting, Will give it a look just for learning purposes. Thanks, @rübe! Share this post Link to post Share on other sites
rübe 127 Posted February 26, 2018 @By-Jokese Also make sure to check out the BIS function library which contains a bunch of handy functions for geometry (dirTo, relPos, ...) and vector maths (vectorMultiply, vectorAdd, crossProduct, dotProduct, rotateVector2D, ...). Share this post Link to post Share on other sites