{"action":"created","issue":{"url":"https://api.github.com/repos/godotengine/godot/issues/6861","repository_url":"https://api.github.com/repos/godotengine/godot","labels_url":"https://api.github.com/repos/godotengine/godot/issues/6861/labels{/name}","comments_url":"https://api.github.com/repos/godotengine/godot/issues/6861/comments","events_url":"https://api.github.com/repos/godotengine/godot/issues/6861/events","html_url":"https://github.com/godotengine/godot/issues/6861","id":183661185,"number":6861,"title":"More constructors for Vectors","user":{"login":"bojidar-bg","id":5276727,"avatar_url":"https://avatars.githubusercontent.com/u/5276727?v=3","gravatar_id":"","url":"https://api.github.com/users/bojidar-bg","html_url":"https://github.com/bojidar-bg","followers_url":"https://api.github.com/users/bojidar-bg/followers","following_url":"https://api.github.com/users/bojidar-bg/following{/other_user}","gists_url":"https://api.github.com/users/bojidar-bg/gists{/gist_id}","starred_url":"https://api.github.com/users/bojidar-bg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojidar-bg/subscriptions","organizations_url":"https://api.github.com/users/bojidar-bg/orgs","repos_url":"https://api.github.com/users/bojidar-bg/repos","events_url":"https://api.github.com/users/bojidar-bg/events{/privacy}","received_events_url":"https://api.github.com/users/bojidar-bg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/godotengine/godot/labels/discussion","name":"discussion","color":"ee77ee"},{"url":"https://api.github.com/repos/godotengine/godot/labels/feature%20proposal","name":"feature proposal","color":"1144ff"},{"url":"https://api.github.com/repos/godotengine/godot/labels/topic:gdscript","name":"topic:gdscript","color":"ffdd44"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-10-18T11:34:21Z","updated_at":"2016-10-19T13:15:47Z","closed_at":null,"body":"Currently, it is pretty long to make a Vector3 out of a Vector2:\r\n```gdscript\r\nVector3(vec2.x, vec2.y, 0)\r\n```\r\nSame goes for vice-versa:\r\n```gdscript\r\nVector2(vec3.x, vec3.y)\r\n```\r\nNow, imagine that the said Vector3/Vector2 has a very long name.. It would quickly become unmanageble, right? :smile: \r\n\r\n---\r\nThat's why, I would like to propose (after a quick discussion with @karroffel and @reduz) a few utility constructors, similar to the shading language (which should be non-implicit, to minimize bugs):\r\n```gdscript\r\nfunc Vector3(Vector2 xy, float z = 0):\r\nfunc Vector3(float x = 0, Vector2 yz):\r\nfunc Vector2(Vector3 xy):\r\n```\r\n\r\nNow, the only few issues with this is that you can't:\r\n1. Make `Vector3(v2.y, v2.x, 0)`, for example\r\n2. Make `Vector2(v3.z, v3.x)`, which might need swizzling to work properly.\r\n\r\nAnyway, what do you think of the proposed constructors? And also, do you think swizzling (`v3.xz`) is useful enough to include in GDScript?"},"comment":{"url":"https://api.github.com/repos/godotengine/godot/issues/comments/254808882","html_url":"https://github.com/godotengine/godot/issues/6861#issuecomment-254808882","issue_url":"https://api.github.com/repos/godotengine/godot/issues/6861","id":254808882,"user":{"login":"bojidar-bg","id":5276727,"avatar_url":"https://avatars.githubusercontent.com/u/5276727?v=3","gravatar_id":"","url":"https://api.github.com/users/bojidar-bg","html_url":"https://github.com/bojidar-bg","followers_url":"https://api.github.com/users/bojidar-bg/followers","following_url":"https://api.github.com/users/bojidar-bg/following{/other_user}","gists_url":"https://api.github.com/users/bojidar-bg/gists{/gist_id}","starred_url":"https://api.github.com/users/bojidar-bg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojidar-bg/subscriptions","organizations_url":"https://api.github.com/users/bojidar-bg/orgs","repos_url":"https://api.github.com/users/bojidar-bg/repos","events_url":"https://api.github.com/users/bojidar-bg/events{/privacy}","received_events_url":"https://api.github.com/users/bojidar-bg/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T13:15:46Z","updated_at":"2016-10-19T13:15:46Z","body":"If #6866 is implemented, we _might_ somehow do this instead:\r\n```gd\r\nVector3(xz = v2, y = 0)\r\n```"}}
{"actor":{"display_login":"bojidar-bg"}}