{"id":261,"date":"2018-06-03T22:45:35","date_gmt":"2018-06-04T03:45:35","guid":{"rendered":"http:\/\/www.chroniclesoftright.com\/blog\/?p=261"},"modified":"2018-06-03T22:45:35","modified_gmt":"2018-06-04T03:45:35","slug":"collision-detection-2","status":"publish","type":"post","link":"https:\/\/www.chroniclesoftright.com\/blog\/2018\/06\/03\/collision-detection-2\/","title":{"rendered":"Collision detection"},"content":{"rendered":"<p>Yep, the next step is definitely collision detection.\u00a0 I&#8217;ve tried this before so I have some context to start from so hopefully I can get something in place pretty soon.\u00a0 I was thinking about collision detection on a long drive yesterday and I think I&#8217;ll need to split collision detection into at least three different types.\u00a0 First, normal collisions between the player and the environment.\u00a0 This will be the most complicated type of system because I need to detect and respond to collisions between a capsule representing the player and arbitrary meshes in the world.\u00a0 Second, collisions between enemies and the world.\u00a0 I think I can simplify this to sphere-sphere collision detection by simply defining the collision zones of all objects as oversized spheres.\u00a0 Some things don&#8217;t lend themselves well to being defined by spheres, for instance a fence.\u00a0 But it doesn&#8217;t matter if an enemy will never walk right up next to any particular object in the world.\u00a0 It won&#8217;t look weird if a boar is never standing right next to a fence object, just as long as no boar ever walks through the fence.\u00a0 I think the sphere-sphere collision system will be needed because these collisions will have to be handled by the server, and there are potentially a lot of those to calculate multiple times a second.\u00a0 Third, I&#8217;ll need to be able to calculate collisions between players and enemies for battle.\u00a0 If you swing your sword I need to know if you are close enough to an enemy to hit it.\u00a0 I think I can use the raycasting capabilities built into THREE.js to do this.<\/p>\n<p>I&#8217;ll start with the hardest general case, then maybe the others will be pretty straightforward.\u00a0 This will take me a while and I may not post many updates while I&#8217;m working on it, so stay tuned.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yep, the next step is definitely collision detection.\u00a0 I&#8217;ve tried this before so I have some context to start from so hopefully I can get something in place pretty soon.\u00a0 I was thinking about collision detection on a long drive yesterday and I think I&#8217;ll need to split collision detection into at least three different&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-261","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\/261","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=261"}],"version-history":[{"count":1,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions\/262"}],"wp:attachment":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}