{"id":2517,"date":"2016-03-20T23:58:37","date_gmt":"2016-03-20T23:58:37","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=2517"},"modified":"2016-03-21T00:05:56","modified_gmt":"2016-03-21T00:05:56","slug":"p-167-paranoia-oculus-rift-horror-game-world-constructor-7-interior-object-creator","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-167-paranoia-oculus-rift-horror-game-world-constructor-7-interior-object-creator\/","title":{"rendered":"P-167: Paranoia: Oculus Rift Horror Game: World Constructor 7: Interior Object Creator"},"content":{"rendered":"<p>I have implemented the basics of the interior object creator for this project. It is very simple at the moment, but it should not be too difficult to expand it.<\/p>\n<p>Creating a system to randomly populate the interior of a structure with objects has been an interesting challenge. I am not quite sure if my solution will work, but I think it should. Instead of randomly placing object within a given radius (which would look chaotic and haphazard) I can place objects by room. So for example, each room would have a designation &#8220;room type&#8221;, Kitchen, Corridor, Bedroom, etc etc, and only object of that room type would be randomly placed in that room. This has the benefits of random placement, without the disadvantage of being truly random and breaking the immersion in the gameworld.<\/p>\n<p>The problem with this approach is that furniture and objects are not placed at random in rooms, they are generally placed in sensible locations, against walls, or stacked neatly, etc. I am hoping that since my game takes place in an abandoned building, that this lack of organisation will not be a problem. If it is, I will have to rethink this. I may need to have designated points in each room where objects can be placed, and I will choose a random point and pair it with a random object. That way the placement won&#8217;t be truly random, but it will differ from room to room.<\/p>\n<p>The other issue is making sure objects don&#8217;t intersect or collide with the walls. I will have to implement my own collision detection algorithm here, since creating objects with SetTransform() ignores collision. I can simple use mathematics to get the centerpoint of the bounds box of each object, and extend a vector from the center to each of the 4 corners of the object. I can then extend a ray down from these 4 points to the ground, and if it does not hit an object other than the floor, the object can be placed. This should work find for smaller objects, and by extending a ray from the centerpoint as well, it should work for larger ones too.<\/p>\n<p>I am using items for the interior objects, not static shapes. This is because I want the player to be able to move these objects out of their way. This will firstly prevent them from getting stuck if the item randomly appears near a door or corridor, and secondly, it will make noise, which will attract the hunter. Items in T3D support physics functions, so they can be easily pushed or pulled using applyimpulse().<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2512\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_13-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_46_13 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_13-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_13-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_13-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_13-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2511\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_17-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_46_17 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_17-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_17-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_17-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_46_17-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2510\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_47_19-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_47_19 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_47_19-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_47_19-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_47_19-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_47_19-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2509\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_09-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_50_09 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_09-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_09-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_09-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_09-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2508\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_36-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_50_36 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_36-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_36-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_36-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_36-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2507\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_43-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_50_43 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_43-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_43-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_43-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_50_43-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2506\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_51_18-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 02_51_18 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_51_18-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_51_18-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_51_18-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-02_51_18-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2505\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-04_37_14-AM-300x238.png\" alt=\"PhoenixGameDevelopment - 18_03_2016 , 04_37_14 AM\" width=\"300\" height=\"238\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-04_37_14-AM-300x238.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-04_37_14-AM-768x610.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-04_37_14-AM-1024x813.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/03\/PhoenixGameDevelopment-18_03_2016-04_37_14-AM.png 1026w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have implemented the basics of the interior object creator for this project. It is very simple at the moment, but it should not be too difficult to expand it. Creating a system to randomly populate the interior of a structure with objects has been an interesting challenge. I am not quite sure if my [&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-2517","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\/2517"}],"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=2517"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2517\/revisions"}],"predecessor-version":[{"id":2520,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2517\/revisions\/2520"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=2517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=2517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=2517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}