{"action":"created","comment":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/comments/30664117","id":30664117,"diff_hunk":"@@ -0,0 +1,68 @@\n+/**\n+ * @author Max Strater, Autodesk, Inc. / http://www.autodesk.com/\n+ *\n+ * A mesh that always faces a specified point (usually a camera).\n+ * Optionally, the mesh can be constrained to a specified axis.\n+ * If so, it will face the specified point as much as possible while remaining aligned with the axis.\n+ * If not constrained, the axis can be used as a custom up vector for the mesh.\n+ * Requires a call to the update method after each change.\n+ * Based on http://nehe.gamedev.net/article/billboarding_how_to/18011/\n+ */\n+\n+// expects a normalized axis\n+THREE.BillboardMesh = function ( geometry, material, point, axis, constrainedToAxis ) {\n+\n+\tTHREE.Mesh.call( this, geometry, material );\n+\n+\tthis.point = point;\n+\tthis.axis = axis || this.up;\n+\tthis.constrained = constrainedToAxis || false;\n+\n+};\n+\n+THREE.BillboardMesh.prototype = Object.create( THREE.Mesh.prototype );\n+THREE.BillboardMesh.prototype.constructor = THREE.BillboardMesh;\n+\n+THREE.BillboardMesh.prototype.update = function () {\n+\n+\tfunction rotateMesh( mesh, towardPoint, up ) {\n+\n+\t\tmesh.up = up;\n+\t\tmesh.lookAt( towardPoint );\n+\n+\t}\n+\n+\tvar look = new THREE.Vector3();\n+\tvar right = new THREE.Vector3();\n+\n+\tfunction rotateAxialConstrainedMesh( mesh, towardPoint, axis ) {\n+\n+\t\tvar meshPosition = mesh.position.clone();\n+\t\tlook.subVectors( towardPoint, meshPosition );\n+\t\tright.crossVectors( axis, look ).normalize();\n+\t\tlook.crossVectors( right, axis ).normalize();\n+\t\tmesh.matrix.set(\n+\t\t\tright.x, axis.x, look.x, meshPosition.x,\n+\t\t\tright.y, axis.y, look.y, meshPosition.y,\n+\t\t\tright.z, axis.z, look.z, meshPosition.z,\n+\t\t\t0,       0,      0,      1\n+\t\t);\n+\t\tmesh.matrix.decompose( mesh.position, mesh.quaternion, mesh.scale );","path":"examples/js/objects/BillboardMesh.js","position":50,"original_position":50,"commit_id":"a2afe75d0185e968e99b39ddf3c70c621402eff4","original_commit_id":"a2afe75d0185e968e99b39ddf3c70c621402eff4","user":{"login":"WestLangley","id":1000017,"avatar_url":"https://avatars.githubusercontent.com/u/1000017?v=3","gravatar_id":"","url":"https://api.github.com/users/WestLangley","html_url":"https://github.com/WestLangley","followers_url":"https://api.github.com/users/WestLangley/followers","following_url":"https://api.github.com/users/WestLangley/following{/other_user}","gists_url":"https://api.github.com/users/WestLangley/gists{/gist_id}","starred_url":"https://api.github.com/users/WestLangley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WestLangley/subscriptions","organizations_url":"https://api.github.com/users/WestLangley/orgs","repos_url":"https://api.github.com/users/WestLangley/repos","events_url":"https://api.github.com/users/WestLangley/events{/privacy}","received_events_url":"https://api.github.com/users/WestLangley/received_events","type":"User","site_admin":false},"body":"By setting the matrix directly, your are clobbering any scale that may have been applied to the object. The position is not changing -- nor is the scale. All you really need to do is set the rotation/quaternion directly.\r\n\r\nI do like your demo, but setting the matrix directly here violates the three.js paradigm.\r\n\r\n","created_at":"2015-05-20T01:11:18Z","updated_at":"2015-05-20T01:11:18Z","html_url":"https://github.com/mrdoob/three.js/pull/6484#discussion_r30664117","pull_request_url":"https://api.github.com/repos/mrdoob/three.js/pulls/6484","_links":{"self":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/comments/30664117"},"html":{"href":"https://github.com/mrdoob/three.js/pull/6484#discussion_r30664117"},"pull_request":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6484"}}},"pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/6484","id":34482804,"html_url":"https://github.com/mrdoob/three.js/pull/6484","diff_url":"https://github.com/mrdoob/three.js/pull/6484.diff","patch_url":"https://github.com/mrdoob/three.js/pull/6484.patch","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/6484","number":6484,"state":"open","locked":false,"title":"Added a BillboardMesh example","user":{"login":"mstrater","id":869527,"avatar_url":"https://avatars.githubusercontent.com/u/869527?v=3","gravatar_id":"","url":"https://api.github.com/users/mstrater","html_url":"https://github.com/mstrater","followers_url":"https://api.github.com/users/mstrater/followers","following_url":"https://api.github.com/users/mstrater/following{/other_user}","gists_url":"https://api.github.com/users/mstrater/gists{/gist_id}","starred_url":"https://api.github.com/users/mstrater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstrater/subscriptions","organizations_url":"https://api.github.com/users/mstrater/orgs","repos_url":"https://api.github.com/users/mstrater/repos","events_url":"https://api.github.com/users/mstrater/events{/privacy}","received_events_url":"https://api.github.com/users/mstrater/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-30T17:35:15Z","updated_at":"2015-05-20T01:11:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3408691bc523ccd60748d276b90ceeaba6d5a37","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mrdoob/three.js/pulls/6484/commits","review_comments_url":"https://api.github.com/repos/mrdoob/three.js/pulls/6484/comments","review_comment_url":"https://api.github.com/repos/mrdoob/three.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/6484/comments","statuses_url":"https://api.github.com/repos/mrdoob/three.js/statuses/a2afe75d0185e968e99b39ddf3c70c621402eff4","head":{"label":"Autodesk:mstrater/billboards","ref":"mstrater/billboards","sha":"a2afe75d0185e968e99b39ddf3c70c621402eff4","user":{"login":"Autodesk","id":7914533,"avatar_url":"https://avatars.githubusercontent.com/u/7914533?v=3","gravatar_id":"","url":"https://api.github.com/users/Autodesk","html_url":"https://github.com/Autodesk","followers_url":"https://api.github.com/users/Autodesk/followers","following_url":"https://api.github.com/users/Autodesk/following{/other_user}","gists_url":"https://api.github.com/users/Autodesk/gists{/gist_id}","starred_url":"https://api.github.com/users/Autodesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Autodesk/subscriptions","organizations_url":"https://api.github.com/users/Autodesk/orgs","repos_url":"https://api.github.com/users/Autodesk/repos","events_url":"https://api.github.com/users/Autodesk/events{/privacy}","received_events_url":"https://api.github.com/users/Autodesk/received_events","type":"Organization","site_admin":false},"repo":{"id":34865122,"name":"three.js","full_name":"Autodesk/three.js","owner":{"login":"Autodesk","id":7914533,"avatar_url":"https://avatars.githubusercontent.com/u/7914533?v=3","gravatar_id":"","url":"https://api.github.com/users/Autodesk","html_url":"https://github.com/Autodesk","followers_url":"https://api.github.com/users/Autodesk/followers","following_url":"https://api.github.com/users/Autodesk/following{/other_user}","gists_url":"https://api.github.com/users/Autodesk/gists{/gist_id}","starred_url":"https://api.github.com/users/Autodesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Autodesk/subscriptions","organizations_url":"https://api.github.com/users/Autodesk/orgs","repos_url":"https://api.github.com/users/Autodesk/repos","events_url":"https://api.github.com/users/Autodesk/events{/privacy}","received_events_url":"https://api.github.com/users/Autodesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Autodesk/three.js","description":"JavaScript 3D library.","fork":true,"url":"https://api.github.com/repos/Autodesk/three.js","forks_url":"https://api.github.com/repos/Autodesk/three.js/forks","keys_url":"https://api.github.com/repos/Autodesk/three.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Autodesk/three.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Autodesk/three.js/teams","hooks_url":"https://api.github.com/repos/Autodesk/three.js/hooks","issue_events_url":"https://api.github.com/repos/Autodesk/three.js/issues/events{/number}","events_url":"https://api.github.com/repos/Autodesk/three.js/events","assignees_url":"https://api.github.com/repos/Autodesk/three.js/assignees{/user}","branches_url":"https://api.github.com/repos/Autodesk/three.js/branches{/branch}","tags_url":"https://api.github.com/repos/Autodesk/three.js/tags","blobs_url":"https://api.github.com/repos/Autodesk/three.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Autodesk/three.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Autodesk/three.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Autodesk/three.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Autodesk/three.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Autodesk/three.js/languages","stargazers_url":"https://api.github.com/repos/Autodesk/three.js/stargazers","contributors_url":"https://api.github.com/repos/Autodesk/three.js/contributors","subscribers_url":"https://api.github.com/repos/Autodesk/three.js/subscribers","subscription_url":"https://api.github.com/repos/Autodesk/three.js/subscription","commits_url":"https://api.github.com/repos/Autodesk/three.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Autodesk/three.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Autodesk/three.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Autodesk/three.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Autodesk/three.js/contents/{+path}","compare_url":"https://api.github.com/repos/Autodesk/three.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Autodesk/three.js/merges","archive_url":"https://api.github.com/repos/Autodesk/three.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Autodesk/three.js/downloads","issues_url":"https://api.github.com/repos/Autodesk/three.js/issues{/number}","pulls_url":"https://api.github.com/repos/Autodesk/three.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Autodesk/three.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Autodesk/three.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Autodesk/three.js/labels{/name}","releases_url":"https://api.github.com/repos/Autodesk/three.js/releases{/id}","created_at":"2015-04-30T16:36:19Z","updated_at":"2015-04-30T16:36:26Z","pushed_at":"2015-05-14T00:47:56Z","git_url":"git://github.com/Autodesk/three.js.git","ssh_url":"git@github.com:Autodesk/three.js.git","clone_url":"https://github.com/Autodesk/three.js.git","svn_url":"https://github.com/Autodesk/three.js","homepage":"http://threejs.org/","size":317080,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mrdoob:dev","ref":"dev","sha":"48eb133b1f3f72dba4a97fa467d7caa49fd85345","user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"repo":{"id":576201,"name":"three.js","full_name":"mrdoob/three.js","owner":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrdoob/three.js","description":"JavaScript 3D library.","fork":false,"url":"https://api.github.com/repos/mrdoob/three.js","forks_url":"https://api.github.com/repos/mrdoob/three.js/forks","keys_url":"https://api.github.com/repos/mrdoob/three.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrdoob/three.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrdoob/three.js/teams","hooks_url":"https://api.github.com/repos/mrdoob/three.js/hooks","issue_events_url":"https://api.github.com/repos/mrdoob/three.js/issues/events{/number}","events_url":"https://api.github.com/repos/mrdoob/three.js/events","assignees_url":"https://api.github.com/repos/mrdoob/three.js/assignees{/user}","branches_url":"https://api.github.com/repos/mrdoob/three.js/branches{/branch}","tags_url":"https://api.github.com/repos/mrdoob/three.js/tags","blobs_url":"https://api.github.com/repos/mrdoob/three.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrdoob/three.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrdoob/three.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrdoob/three.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrdoob/three.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mrdoob/three.js/languages","stargazers_url":"https://api.github.com/repos/mrdoob/three.js/stargazers","contributors_url":"https://api.github.com/repos/mrdoob/three.js/contributors","subscribers_url":"https://api.github.com/repos/mrdoob/three.js/subscribers","subscription_url":"https://api.github.com/repos/mrdoob/three.js/subscription","commits_url":"https://api.github.com/repos/mrdoob/three.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrdoob/three.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrdoob/three.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrdoob/three.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrdoob/three.js/contents/{+path}","compare_url":"https://api.github.com/repos/mrdoob/three.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrdoob/three.js/merges","archive_url":"https://api.github.com/repos/mrdoob/three.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrdoob/three.js/downloads","issues_url":"https://api.github.com/repos/mrdoob/three.js/issues{/number}","pulls_url":"https://api.github.com/repos/mrdoob/three.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mrdoob/three.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mrdoob/three.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrdoob/three.js/labels{/name}","releases_url":"https://api.github.com/repos/mrdoob/three.js/releases{/id}","created_at":"2010-03-23T18:58:01Z","updated_at":"2015-05-19T22:10:57Z","pushed_at":"2015-05-19T19:38:53Z","git_url":"git://github.com/mrdoob/three.js.git","ssh_url":"git@github.com:mrdoob/three.js.git","clone_url":"https://github.com/mrdoob/three.js.git","svn_url":"https://github.com/mrdoob/three.js","homepage":"http://threejs.org/","size":381630,"stargazers_count":19563,"watchers_count":19563,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":5823,"mirror_url":null,"open_issues_count":835,"forks":5823,"open_issues":835,"watchers":19563,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6484"},"html":{"href":"https://github.com/mrdoob/three.js/pull/6484"},"issue":{"href":"https://api.github.com/repos/mrdoob/three.js/issues/6484"},"comments":{"href":"https://api.github.com/repos/mrdoob/three.js/issues/6484/comments"},"review_comments":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6484/comments"},"review_comment":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6484/commits"},"statuses":{"href":"https://api.github.com/repos/mrdoob/three.js/statuses/a2afe75d0185e968e99b39ddf3c70c621402eff4"}}}}