{"id":376,"date":"2018-10-28T23:43:12","date_gmt":"2018-10-29T04:43:12","guid":{"rendered":"http:\/\/www.chroniclesoftright.com\/blog\/?p=376"},"modified":"2018-10-28T23:43:12","modified_gmt":"2018-10-29T04:43:12","slug":"more-collision-detection-2","status":"publish","type":"post","link":"https:\/\/www.chroniclesoftright.com\/blog\/2018\/10\/28\/more-collision-detection-2\/","title":{"rendered":"More collision detection"},"content":{"rendered":"<p>I have incorporated the collision detection system in its current state into the game engine.\u00a0 This took some time because I was fighting with the Blender-to-THREE workflow again.\u00a0 Here&#8217;s a little sidebar on that.<\/p>\n<p>The recommended file format for working with 3D assets in THREE is glTF.\u00a0 This format is maintained by Khronos Group and includes important features like materials and animations.\u00a0 Unfortunately, it&#8217;s also been a huge pain to work with so far.\u00a0 Creating assets in Blender then exporting them to glTF seems to work fine, but working with the imported assets in THREE is just quirky sometimes.\u00a0 When you import a file it is added as a Scene that you then have to add to an existing Scene.\u00a0 The geometries are all BufferGeometry objects (which is actually a good thing for performance, but difficult to work with) and you just have to really work at getting things to line up just right.<\/p>\n<p>I wanted to be able to model an asset in Blender, model a collision object separately but in the same file, then import the file with THREE and tell my collision detection system to use the hidden collision object.\u00a0 This way I can make the asset somewhat complex but still keep a simple collision cage for performance reasons.\u00a0 I don&#8217;t think this should be complicated but I struggled with it.\u00a0 Partially I still have trouble with asynchronous aspects of Javascript programming and so I was just confused.\u00a0 Partially it&#8217;s just somewhat difficult to do what I want to do with THREE.<\/p>\n<p>After quite a bit of tinkering my system is now working.\u00a0 I have a weirdly shaped concave object with a separately modeled (also concave) collision cage that I put into a map file.\u00a0 My engine loads the asset, recognizes the collision cage, and the collision system responds correctly when you walk around it.<\/p>\n<p>This is a big step in the right direction.\u00a0 Next I still need to do pretty much everything from my last post, but I have a working system already integrated into the rest of the engine.\u00a0 Hopefully this will keep me motivated to finish the code rewrite, implement gravity, blah blah blah.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have incorporated the collision detection system in its current state into the game engine.\u00a0 This took some time because I was fighting with the Blender-to-THREE workflow again.\u00a0 Here&#8217;s a little sidebar on that. The recommended file format for working with 3D assets in THREE is glTF.\u00a0 This format is maintained by Khronos Group and&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-376","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\/376","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=376"}],"version-history":[{"count":1,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/376\/revisions"}],"predecessor-version":[{"id":377,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/376\/revisions\/377"}],"wp:attachment":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/media?parent=376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/categories?post=376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/tags?post=376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}