{"action":"created","comment":{"url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/comments/68082418","id":68082418,"diff_hunk":"@@ -54,49 +54,37 @@ Author:\n #include \"script_component.hpp\"\r\n SCRIPT(headDir);\r\n \r\n-private[\"_azimuth\", \"_angle\", \"_dif\", \"_infov\", \"_object\", \"_threed\", \"_do\"];\r\n-\r\n-params [\"_unit\"];\r\n-_object = param [1,_unit];\r\n-_threed = false;\r\n-\r\n-_do = (typeName _object != typeName _unit);\r\n-if (!_do) then {\r\n-    _do = (_object != _unit);\r\n-};\r\n-\r\n-if (_do) then {\r\n-    _angle = [(_unit call CBA_fnc_getPos),(_object call CBA_fnc_getPos)] call BIS_fnc_dirTo;\r\n-} else {\r\n-    _angle = 0;\r\n-};\r\n-if (_unit != player) then\r\n-{\r\n-    _azimuth = getdir _unit;\r\n+params [\r\n+    [\"_unit\", objNull, [objNull]],\r\n+    [\"_offsetObject\", objNull]\r\n+];\r\n+\r\n+private _azimuth = 0;\r\n+private _isExternalCam = false;\r\n+if (_unit != call CBA_fnc_currentUnit) then {\r\n+    _azimuth = getDir _unit;\r\n } else {\r\n-    private [\"_position\",\"_viewPos\",\"_vector\",\"_magnitude\"];\r\n-    _position = positionCameraToWorld [0, 0, 0];\r\n-    _threed = if ((_position distance _unit)>2) then {true} else {false};\r\n-    _viewPos = positionCameraToWorld [0, 0, 99999999];\r\n-    _vector = [\r\n-        (_viewPos select 0) - (_position select 0),\r\n-        (_viewPos select 1) - (_position select 1),\r\n-        (_viewPos select 2) - (_position select 2)\r\n-    ];\r\n-    _magnitude = [0, 0, 0] distance _vector;\r\n-    _vector = [\r\n-        (_vector select 0) / _magnitude,\r\n-        (_vector select 1) / _magnitude,\r\n-        (_vector select 2) / _magnitude\r\n-    ];\r\n+    private _camPos = AGLToASL positionCameraToWorld [0, 0, 0];\r\n+    _isExternalCam = (_camPos vectorDistance getPosASL _unit) > 2;\r\n+    private _viewPos = AGLToASL positionCameraToWorld [0, 0, 99999999];\r\n+    private _vector = _viewPos vectorDiff _camPos;\r\n+    _vector = _vector vectorMultiply (1 / vectorMagnitude _vector);\r\n     _azimuth = (_vector select 0) atan2 (_vector select 1);\r\n     _azimuth = [_azimuth] call CBA_fnc_simplifyAngle;\r","path":"addons/common/fnc_headDir.sqf","position":54,"original_position":54,"commit_id":"89f16951612931366fcd0683057d5c7f1ba43e95","original_commit_id":"89f16951612931366fcd0683057d5c7f1ba43e95","user":{"login":"commy2","id":6576312,"avatar_url":"https://avatars.githubusercontent.com/u/6576312?v=3","gravatar_id":"","url":"https://api.github.com/users/commy2","html_url":"https://github.com/commy2","followers_url":"https://api.github.com/users/commy2/followers","following_url":"https://api.github.com/users/commy2/following{/other_user}","gists_url":"https://api.github.com/users/commy2/gists{/gist_id}","starred_url":"https://api.github.com/users/commy2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commy2/subscriptions","organizations_url":"https://api.github.com/users/commy2/orgs","repos_url":"https://api.github.com/users/commy2/repos","events_url":"https://api.github.com/users/commy2/events{/privacy}","received_events_url":"https://api.github.com/users/commy2/received_events","type":"User","site_admin":false},"body":"We probably don't need this. The angle is \"simplified\" with ^","created_at":"2016-06-22T16:03:33Z","updated_at":"2016-06-22T16:03:33Z","html_url":"https://github.com/CBATeam/CBA_A3/pull/390#discussion_r68082418","pull_request_url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390","_links":{"self":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/comments/68082418"},"html":{"href":"https://github.com/CBATeam/CBA_A3/pull/390#discussion_r68082418"},"pull_request":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390"}}},"pull_request":{"url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390","id":74759308,"html_url":"https://github.com/CBATeam/CBA_A3/pull/390","diff_url":"https://github.com/CBATeam/CBA_A3/pull/390.diff","patch_url":"https://github.com/CBATeam/CBA_A3/pull/390.patch","issue_url":"https://api.github.com/repos/CBATeam/CBA_A3/issues/390","number":390,"state":"open","locked":false,"title":"Update fnc_headDir","user":{"login":"654wak654","id":8149303,"avatar_url":"https://avatars.githubusercontent.com/u/8149303?v=3","gravatar_id":"","url":"https://api.github.com/users/654wak654","html_url":"https://github.com/654wak654","followers_url":"https://api.github.com/users/654wak654/followers","following_url":"https://api.github.com/users/654wak654/following{/other_user}","gists_url":"https://api.github.com/users/654wak654/gists{/gist_id}","starred_url":"https://api.github.com/users/654wak654/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/654wak654/subscriptions","organizations_url":"https://api.github.com/users/654wak654/orgs","repos_url":"https://api.github.com/users/654wak654/repos","events_url":"https://api.github.com/users/654wak654/events{/privacy}","received_events_url":"https://api.github.com/users/654wak654/received_events","type":"User","site_admin":false},"body":"When merged this PR will:\r\n1. Update the function using new commands\r\n2. Clean old code\r\n","created_at":"2016-06-22T10:25:04Z","updated_at":"2016-06-22T16:03:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d689d1f0ae160a387d02b989d1609f156df093a","assignee":null,"milestone":{"url":"https://api.github.com/repos/CBATeam/CBA_A3/milestones/15","html_url":"https://github.com/CBATeam/CBA_A3/milestones/2.4.2","labels_url":"https://api.github.com/repos/CBATeam/CBA_A3/milestones/15/labels","id":1811610,"number":15,"title":"2.4.2","description":"For any issues that might come up","creator":{"login":"Killswitch00","id":12647603,"avatar_url":"https://avatars.githubusercontent.com/u/12647603?v=3","gravatar_id":"","url":"https://api.github.com/users/Killswitch00","html_url":"https://github.com/Killswitch00","followers_url":"https://api.github.com/users/Killswitch00/followers","following_url":"https://api.github.com/users/Killswitch00/following{/other_user}","gists_url":"https://api.github.com/users/Killswitch00/gists{/gist_id}","starred_url":"https://api.github.com/users/Killswitch00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Killswitch00/subscriptions","organizations_url":"https://api.github.com/users/Killswitch00/orgs","repos_url":"https://api.github.com/users/Killswitch00/repos","events_url":"https://api.github.com/users/Killswitch00/events{/privacy}","received_events_url":"https://api.github.com/users/Killswitch00/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":16,"state":"open","created_at":"2016-06-06T18:31:23Z","updated_at":"2016-06-22T15:53:18Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390/commits","review_comments_url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390/comments","review_comment_url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CBATeam/CBA_A3/issues/390/comments","statuses_url":"https://api.github.com/repos/CBATeam/CBA_A3/statuses/89f16951612931366fcd0683057d5c7f1ba43e95","head":{"label":"654wak654:patch-1","ref":"patch-1","sha":"89f16951612931366fcd0683057d5c7f1ba43e95","user":{"login":"654wak654","id":8149303,"avatar_url":"https://avatars.githubusercontent.com/u/8149303?v=3","gravatar_id":"","url":"https://api.github.com/users/654wak654","html_url":"https://github.com/654wak654","followers_url":"https://api.github.com/users/654wak654/followers","following_url":"https://api.github.com/users/654wak654/following{/other_user}","gists_url":"https://api.github.com/users/654wak654/gists{/gist_id}","starred_url":"https://api.github.com/users/654wak654/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/654wak654/subscriptions","organizations_url":"https://api.github.com/users/654wak654/orgs","repos_url":"https://api.github.com/users/654wak654/repos","events_url":"https://api.github.com/users/654wak654/events{/privacy}","received_events_url":"https://api.github.com/users/654wak654/received_events","type":"User","site_admin":false},"repo":{"id":60434306,"name":"CBA_A3","full_name":"654wak654/CBA_A3","owner":{"login":"654wak654","id":8149303,"avatar_url":"https://avatars.githubusercontent.com/u/8149303?v=3","gravatar_id":"","url":"https://api.github.com/users/654wak654","html_url":"https://github.com/654wak654","followers_url":"https://api.github.com/users/654wak654/followers","following_url":"https://api.github.com/users/654wak654/following{/other_user}","gists_url":"https://api.github.com/users/654wak654/gists{/gist_id}","starred_url":"https://api.github.com/users/654wak654/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/654wak654/subscriptions","organizations_url":"https://api.github.com/users/654wak654/orgs","repos_url":"https://api.github.com/users/654wak654/repos","events_url":"https://api.github.com/users/654wak654/events{/privacy}","received_events_url":"https://api.github.com/users/654wak654/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/654wak654/CBA_A3","description":"Community Base Addons for Arma 3","fork":true,"url":"https://api.github.com/repos/654wak654/CBA_A3","forks_url":"https://api.github.com/repos/654wak654/CBA_A3/forks","keys_url":"https://api.github.com/repos/654wak654/CBA_A3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/654wak654/CBA_A3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/654wak654/CBA_A3/teams","hooks_url":"https://api.github.com/repos/654wak654/CBA_A3/hooks","issue_events_url":"https://api.github.com/repos/654wak654/CBA_A3/issues/events{/number}","events_url":"https://api.github.com/repos/654wak654/CBA_A3/events","assignees_url":"https://api.github.com/repos/654wak654/CBA_A3/assignees{/user}","branches_url":"https://api.github.com/repos/654wak654/CBA_A3/branches{/branch}","tags_url":"https://api.github.com/repos/654wak654/CBA_A3/tags","blobs_url":"https://api.github.com/repos/654wak654/CBA_A3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/654wak654/CBA_A3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/654wak654/CBA_A3/git/refs{/sha}","trees_url":"https://api.github.com/repos/654wak654/CBA_A3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/654wak654/CBA_A3/statuses/{sha}","languages_url":"https://api.github.com/repos/654wak654/CBA_A3/languages","stargazers_url":"https://api.github.com/repos/654wak654/CBA_A3/stargazers","contributors_url":"https://api.github.com/repos/654wak654/CBA_A3/contributors","subscribers_url":"https://api.github.com/repos/654wak654/CBA_A3/subscribers","subscription_url":"https://api.github.com/repos/654wak654/CBA_A3/subscription","commits_url":"https://api.github.com/repos/654wak654/CBA_A3/commits{/sha}","git_commits_url":"https://api.github.com/repos/654wak654/CBA_A3/git/commits{/sha}","comments_url":"https://api.github.com/repos/654wak654/CBA_A3/comments{/number}","issue_comment_url":"https://api.github.com/repos/654wak654/CBA_A3/issues/comments{/number}","contents_url":"https://api.github.com/repos/654wak654/CBA_A3/contents/{+path}","compare_url":"https://api.github.com/repos/654wak654/CBA_A3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/654wak654/CBA_A3/merges","archive_url":"https://api.github.com/repos/654wak654/CBA_A3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/654wak654/CBA_A3/downloads","issues_url":"https://api.github.com/repos/654wak654/CBA_A3/issues{/number}","pulls_url":"https://api.github.com/repos/654wak654/CBA_A3/pulls{/number}","milestones_url":"https://api.github.com/repos/654wak654/CBA_A3/milestones{/number}","notifications_url":"https://api.github.com/repos/654wak654/CBA_A3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/654wak654/CBA_A3/labels{/name}","releases_url":"https://api.github.com/repos/654wak654/CBA_A3/releases{/id}","deployments_url":"https://api.github.com/repos/654wak654/CBA_A3/deployments","created_at":"2016-06-04T23:15:24Z","updated_at":"2016-06-04T23:15:27Z","pushed_at":"2016-06-22T15:55:08Z","git_url":"git://github.com/654wak654/CBA_A3.git","ssh_url":"git@github.com:654wak654/CBA_A3.git","clone_url":"https://github.com/654wak654/CBA_A3.git","svn_url":"https://github.com/654wak654/CBA_A3","homepage":"","size":9775,"stargazers_count":0,"watchers_count":0,"language":"SQF","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CBATeam:master","ref":"master","sha":"01ca3e2bd117afe9995e8ae85fd21d5c993971ea","user":{"login":"CBATeam","id":12647545,"avatar_url":"https://avatars.githubusercontent.com/u/12647545?v=3","gravatar_id":"","url":"https://api.github.com/users/CBATeam","html_url":"https://github.com/CBATeam","followers_url":"https://api.github.com/users/CBATeam/followers","following_url":"https://api.github.com/users/CBATeam/following{/other_user}","gists_url":"https://api.github.com/users/CBATeam/gists{/gist_id}","starred_url":"https://api.github.com/users/CBATeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CBATeam/subscriptions","organizations_url":"https://api.github.com/users/CBATeam/orgs","repos_url":"https://api.github.com/users/CBATeam/repos","events_url":"https://api.github.com/users/CBATeam/events{/privacy}","received_events_url":"https://api.github.com/users/CBATeam/received_events","type":"Organization","site_admin":false},"repo":{"id":36454957,"name":"CBA_A3","full_name":"CBATeam/CBA_A3","owner":{"login":"CBATeam","id":12647545,"avatar_url":"https://avatars.githubusercontent.com/u/12647545?v=3","gravatar_id":"","url":"https://api.github.com/users/CBATeam","html_url":"https://github.com/CBATeam","followers_url":"https://api.github.com/users/CBATeam/followers","following_url":"https://api.github.com/users/CBATeam/following{/other_user}","gists_url":"https://api.github.com/users/CBATeam/gists{/gist_id}","starred_url":"https://api.github.com/users/CBATeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CBATeam/subscriptions","organizations_url":"https://api.github.com/users/CBATeam/orgs","repos_url":"https://api.github.com/users/CBATeam/repos","events_url":"https://api.github.com/users/CBATeam/events{/privacy}","received_events_url":"https://api.github.com/users/CBATeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CBATeam/CBA_A3","description":"Community Base Addons for Arma 3","fork":false,"url":"https://api.github.com/repos/CBATeam/CBA_A3","forks_url":"https://api.github.com/repos/CBATeam/CBA_A3/forks","keys_url":"https://api.github.com/repos/CBATeam/CBA_A3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CBATeam/CBA_A3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CBATeam/CBA_A3/teams","hooks_url":"https://api.github.com/repos/CBATeam/CBA_A3/hooks","issue_events_url":"https://api.github.com/repos/CBATeam/CBA_A3/issues/events{/number}","events_url":"https://api.github.com/repos/CBATeam/CBA_A3/events","assignees_url":"https://api.github.com/repos/CBATeam/CBA_A3/assignees{/user}","branches_url":"https://api.github.com/repos/CBATeam/CBA_A3/branches{/branch}","tags_url":"https://api.github.com/repos/CBATeam/CBA_A3/tags","blobs_url":"https://api.github.com/repos/CBATeam/CBA_A3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CBATeam/CBA_A3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CBATeam/CBA_A3/git/refs{/sha}","trees_url":"https://api.github.com/repos/CBATeam/CBA_A3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CBATeam/CBA_A3/statuses/{sha}","languages_url":"https://api.github.com/repos/CBATeam/CBA_A3/languages","stargazers_url":"https://api.github.com/repos/CBATeam/CBA_A3/stargazers","contributors_url":"https://api.github.com/repos/CBATeam/CBA_A3/contributors","subscribers_url":"https://api.github.com/repos/CBATeam/CBA_A3/subscribers","subscription_url":"https://api.github.com/repos/CBATeam/CBA_A3/subscription","commits_url":"https://api.github.com/repos/CBATeam/CBA_A3/commits{/sha}","git_commits_url":"https://api.github.com/repos/CBATeam/CBA_A3/git/commits{/sha}","comments_url":"https://api.github.com/repos/CBATeam/CBA_A3/comments{/number}","issue_comment_url":"https://api.github.com/repos/CBATeam/CBA_A3/issues/comments{/number}","contents_url":"https://api.github.com/repos/CBATeam/CBA_A3/contents/{+path}","compare_url":"https://api.github.com/repos/CBATeam/CBA_A3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CBATeam/CBA_A3/merges","archive_url":"https://api.github.com/repos/CBATeam/CBA_A3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CBATeam/CBA_A3/downloads","issues_url":"https://api.github.com/repos/CBATeam/CBA_A3/issues{/number}","pulls_url":"https://api.github.com/repos/CBATeam/CBA_A3/pulls{/number}","milestones_url":"https://api.github.com/repos/CBATeam/CBA_A3/milestones{/number}","notifications_url":"https://api.github.com/repos/CBATeam/CBA_A3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CBATeam/CBA_A3/labels{/name}","releases_url":"https://api.github.com/repos/CBATeam/CBA_A3/releases{/id}","deployments_url":"https://api.github.com/repos/CBATeam/CBA_A3/deployments","created_at":"2015-05-28T17:34:05Z","updated_at":"2016-06-20T23:21:05Z","pushed_at":"2016-06-22T15:55:09Z","git_url":"git://github.com/CBATeam/CBA_A3.git","ssh_url":"git@github.com:CBATeam/CBA_A3.git","clone_url":"https://github.com/CBATeam/CBA_A3.git","svn_url":"https://github.com/CBATeam/CBA_A3","homepage":"","size":10978,"stargazers_count":85,"watchers_count":85,"language":"SQF","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":39,"mirror_url":null,"open_issues_count":20,"forks":39,"open_issues":20,"watchers":85,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390"},"html":{"href":"https://github.com/CBATeam/CBA_A3/pull/390"},"issue":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/issues/390"},"comments":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/issues/390/comments"},"review_comments":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390/comments"},"review_comment":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/pulls/390/commits"},"statuses":{"href":"https://api.github.com/repos/CBATeam/CBA_A3/statuses/89f16951612931366fcd0683057d5c7f1ba43e95"}}}}
{"actor":{"display_login":"commy2"}}