So my issue is this: I am working on a first person game in three.js and using imported .gltf / .glb models for the levels. I want to use bounding boxes to cordon off areas where the player shouldn’t be able to move. Right now, there is a house model that I’m using for the first level, so the walls of the house should have bounding boxes around them so the player can’t walk through them, but the open doorway should not.
The problem is that if I traverse the house’s meshes and use the bounding box’s setFromObject function of each on them, there is no allowance for convexity/concavity: it just makes a box around the mesh’s location. This results in a whole box around an open door way, for example, which means the player cannot enter the house.
For the first level (the house) I solved this by hardcoding the position of 40 bounding boxes to mark where the player should not be able to walk through. This works perfectly, but is obviously not ideal as it is time-consuming and the hard-coded nature of the boxes makes things more difficult to change than they should be. Does anyone know of a way to create a bounding box which conforms to a loaded object’s dimensions in this way?