Detecting if player is inside enclosed room

I am currently working on a sound module to create realistic soundscapes for my game. One of the features I intend to implement into this system is the ability to detect when a player is inside or outside in order to apply proper reverb etc for interiors. I’ve recently got back into studio after not touching Roblox quite a long time, and since features have been added and methods have changed, I am wondering how I could go about doing this most efficiently.

Back in the day, I would have most likely used raytracing to check if the player was surrounded by walls, although I dont believe that is a very efficient method. I’m aware that I could also use predefined volumes to apply the effects but id prefer something more dynamic and cleaner.

1 Like

…You could try using Region3

Thought about this but not sure how to implement it. How would I detect that the player is in fact inside?
I’ve messed with region3 a little back in the day for terrain but from what I recollect it returns an array of all the parts inside the region3. I’m not too sure how I should use this information to reach my goal

I think you can use this. You can put player’s decendants in a whitelist and check if they are there. If they are there you can do what you are trying to accomplish.

I suppose I could create hitboxes for individual areas and convert them to region3 when the game runs. It would create a bit of clutter in the map on studio but it seems to be the best way to go about doing this.

1 Like

This is a very likable practice and can be time consuming if you have a lot of indoor space so you can use raycast and see if there are walls and floors around the player every second.

Hey this post is over a year old, but for you and those reading i’ve found that the best way of handling this is by creating a large voxel grid and using the size and location of tagged parts to denote ‘indoor’ voxels.

We have had this working smoothly in a development build of our game for months and yesterday tested with a full 60 player server and found no issues, game running smooth with good network receive and minimal mem usage

1 Like

How would you find out when players have the ability to create walls and floors?

Just run a check to determine which voxels occupy the volume of the created room and change their value.