{"id":2536,"date":"2016-03-27T23:54:02","date_gmt":"2016-03-27T22:54:02","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=2536"},"modified":"2016-03-27T23:54:02","modified_gmt":"2016-03-27T22:54:02","slug":"p-167-paranoia-oculus-rift-horror-game-world-constructor-9-interior-object-placement","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-167-paranoia-oculus-rift-horror-game-world-constructor-9-interior-object-placement\/","title":{"rendered":"P-167: Paranoia: Oculus Rift Horror Game: World Constructor 9: Interior Object Placement"},"content":{"rendered":"<p>I have finished the final major coding challenge of this project. I have created a relatively complex system to randomly place interior objects in each of the rooms of the level.<\/p>\n<p>The hardest part of this was placing the objects in a random way without having them intersect with the walls or each other. The conventional collision mechanics don&#8217;t work when placing the objects like this, so I had to try a few different approaches (various complex calculations to check the extents of the shapes, various raycasting techniques, etc).<\/p>\n<p>As it turned out, the solution was quite simple, I just needed to do a containerradiussearch() from the objects position to the maximum extent of that object, given by getworldbox(). This will work very well as long as the object is mostly square. I had to write a little hack to ignore the z-axis of the search, since objects on multiple floors may be directly above each other without colliding.<\/p>\n<p>I have a little more work to do here with regards to improving the realism. I want to add a system to assign each room a &#8220;room type&#8221;, and make sure that only objects from that room type are created in that room. This will make sure objects &#8220;make sense&#8221; in their location and surroundings.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2534\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_14_57-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 12_14_57 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_14_57-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_14_57-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_14_57-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_14_57-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2533\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_24_22-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 12_24_22 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_24_22-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_24_22-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_24_22-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_24_22-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2531\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-10_30_29-PM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 10_30_29 PM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-10_30_29-PM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-10_30_29-PM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-10_30_29-PM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-10_30_29-PM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2532\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_25_34-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 12_25_34 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_25_34-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_25_34-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_25_34-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-12_25_34-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2530\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_11_57-PM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 11_11_57 PM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_11_57-PM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_11_57-PM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_11_57-PM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_11_57-PM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2529\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_09-PM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 11_12_09 PM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_09-PM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_09-PM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_09-PM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_09-PM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2528\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_18-PM-300x238.png\" alt=\"PhoenixGameDevelopment - 25_03_2016 , 11_12_18 PM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_18-PM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_18-PM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_18-PM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-25_03_2016-11_12_18-PM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2527\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-03_11_21-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 27_03_2016 , 03_11_21 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-03_11_21-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-03_11_21-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-03_11_21-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-03_11_21-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2526\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-08_29_53-PM-300x238.png\" alt=\"PhoenixGameDevelopment - 27_03_2016 , 08_29_53 PM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-08_29_53-PM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-08_29_53-PM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-08_29_53-PM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-27_03_2016-08_29_53-PM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have finished the final major coding challenge of this project. I have created a relatively complex system to randomly place interior objects in each of the rooms of the level. The hardest part of this was placing the objects in a random way without having them intersect with the walls or each other. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,10],"tags":[],"class_list":["post-2536","post","type-post","status-publish","format-standard","hentry","category-p-0","category-software-and-games","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"aioseo_notices":[],"builder_content":"","_links":{"self":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2536"}],"collection":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/comments?post=2536"}],"version-history":[{"count":1,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2536\/revisions"}],"predecessor-version":[{"id":2538,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2536\/revisions\/2538"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=2536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=2536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=2536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}