P-167: Paranoia: Oculus Rift Horror Game: World Constructor 9: Interior Object Placement
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 conventional collision mechanics don’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).
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.
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 “room type”, and make sure that only objects from that room type are created in that room. This will make sure objects “make sense” in their location and surroundings.

