anthonyfromtheuk 6 Posted October 6, 2015 I am using this to create a marker randomly near my player unit. It spawns the marker in a random direction within 100 meters _marker1 = createMarker ["marker1", [player, 100, random 360] call BIS_fnc_relPos ]; Does anybody know how to make the marker spawn in front of the player instead of just randomly? So say for example the players facing dead north then the marker will spawn some where between 270 and 90 degrees? The marker would spawn somewhere in the red area on the image below if the player was facing north. Even just being able to choose a range of bearings the marker will spawn in would be useful such as 270 to 90 degrees regardless of what direction the players facing but really I would like the players current direction to be used as a centre point and for the the marker to spawn some where 180 degrees ahead of him So if the player was facing west instead then the marker will spawn in the red below instead. Thanks if you can help 1 Share this post Link to post Share on other sites
R3vo 2652 Posted October 6, 2015 Does anybody know how to make the marker spawn in front of the player instead of just randomly? _dirUnit = getDir _unit; _markPos = [_unit, 10, _dirUnit] call BIS_fnc_relPos; https://community.bistudio.com/wiki/BIS_fnc_relPos 1 Share this post Link to post Share on other sites
Larrow 2794 Posted October 7, 2015 _angleSector = 180; _dir = getDir player; _randomAngle = random _angleSector; _from = _dir - ( _angleSector / 2 ); _pos = [ player, 10, _from + _randomAngle ] call BIS_fnc_relPos; Where _angleSector is the range you want to cover so 180 as per the red area in your post. You then take half of this area away from the direction the player is facing ... _from Your position then ends up being _from + a random amount from the _angleSector 1 Share this post Link to post Share on other sites
anthonyfromtheuk 6 Posted October 7, 2015 Brilliant thank you Larrow I will try this out, this will be very useful! Share this post Link to post Share on other sites
anthonyfromtheuk 6 Posted October 7, 2015 I tried this out and it is perfect as you can see in the image! All those enemy have been spawned using the random marker while I am in the middle facing the direction of the blue arrow. Sorry for posting a big ugly image Share this post Link to post Share on other sites