Rough Knight 9 Posted April 16, 2009 Hi guys, I am at a loss how to do this so hopefully someone can give me some pointers. I am trying to return the position x distance directly in front of the player regardless of the direction they are facing.I have made a POW rescue mission for Afgan Village but the POWs sometimes can't navigate their way out of dense urban building areas. I figure 1 way around it is to be able to teleport them to a position directly in front of you if you are within 2 metres of them and there are no enemies around.I figure with getdir I can find my angle, I would also know one side of a triangles length by setting how far they would be moved in front of me.With the setpos comand I am not sure if you can set the angle of the comand relative to your own direction? I am not sure if I have explained that very clear, but would anyone please be able to guide me if you understand what I am trying to do? Thanks again Frosty Share this post Link to post Share on other sites
dr_eyeball 16 Posted April 16, 2009 (edited) Edit: @CarlGustaffa: True, modelToWorld would suit ideally for this case, since the direction is already relative. Try this or a variation of it. relPos.sqf: // Desc: offset a position by a certain amount in a certain direction private ['_pos', '_dir', '_distance', '_x', '_y', '_z', '_newPos']; _pos = _this select 0; _distance = _this select 1; _dir = _this select 2; _x = (_pos select 0)+(_distance * sin(_dir)); _y = (_pos select 1)+(_distance * cos(_dir)); _z = (_pos select 2); _newPos = [_x, _y, _z]; _newPos; Edited April 16, 2009 by Dr_Eyeball Share this post Link to post Share on other sites
CarlGustaffa 4 Posted April 16, 2009 Also, would modelToWorld work? Share this post Link to post Share on other sites
Rough Knight 9 Posted April 16, 2009 Thanks for the fast replies guys. Doc....that worked perfectly...I slightly modded it to suit the rest of my script. Now I have to think about how it works...I want to understand what its doing. Also I will read about modeltoworld. I haven't come across that before. Thanks again guys. Frosty Share this post Link to post Share on other sites