{"id":138,"date":"2018-05-03T18:00:12","date_gmt":"2018-05-03T23:00:12","guid":{"rendered":"http:\/\/www.chroniclesoftright.com\/blog\/?p=138"},"modified":"2018-05-02T11:21:44","modified_gmt":"2018-05-02T16:21:44","slug":"raycasting","status":"publish","type":"post","link":"https:\/\/www.chroniclesoftright.com\/blog\/2018\/05\/03\/raycasting\/","title":{"rendered":"Raycasting"},"content":{"rendered":"<p>Raycasting has been giving me fits.\u00a0 The problems I was having with raycasting are what really pushed me to switch to a perspective camera in the world editor but it turns out that wasn&#8217;t really the issue.\u00a0 I&#8217;m not completely sure what was causing the problem but after a fair amount of digging I discovered that rays were always being shot just below the pointer&#8217;s location on the screen.\u00a0 No matter which way the camera was oriented, rays were always just low.\u00a0 I really banged my head against a wall on this one but finally figured out that the menu at the top of the editor was throwing off something.\u00a0 I had the &lt;div&gt; containing the menu nested inside the &lt;div&gt; to which THREE.js adds a canvas for rendering.\u00a0 This was messing up some kind of calculation and making THREE.js think the screen was shorter than reality and consistently pushing rays down.\u00a0 To fix this I just moved the nav bar &lt;div&gt; beside the display &lt;div&gt; and set its location to &#8220;absolute&#8221; with CSS.\u00a0 This fixed the issue with raycasting and also made the background of the menu not stretch all the way across the screen, which I kind of like, so that was a happy accident.\u00a0 Now that raycasting is working again, I can work on selecting objects and improving the tools to manipulate them in a scene.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Raycasting has been giving me fits.\u00a0 The problems I was having with raycasting are what really pushed me to switch to a perspective camera in the world editor but it turns out that wasn&#8217;t really the issue.\u00a0 I&#8217;m not completely sure what was causing the problem but after a fair amount of digging I discovered&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-138","post","type-post","status-publish","format-standard","hentry","category-planning-and-development"],"_links":{"self":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/comments?post=138"}],"version-history":[{"count":1,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/138\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/138\/revisions\/139"}],"wp:attachment":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/media?parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/categories?post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/tags?post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}