Author Topic: Checking for space  (Read 779 times)

Hello, I'm working on a little something and need to check that there is room for a player at a given spot. I have a position, and I need to make sure that a normally-scaled player will fit in it, without getting stuck in a wall/other object. This is to make sure that the player isn't spawned inside a wall.


do a ContainerBoxSearch where you plan to put the player that checks for bricks, interiors, etc.

Code: [Select]
initContainerBoxSearch(%positionXYZ,%sizeXYZ,$typemasks::fxBrickObjectType | $typemasks::interiorObjectType ... );

%target=containerSearchNext()

Note that the box search position is located at the exact center of the box, while the player is actually "located" at a point in between its feet, so you'll have to compensate for that. I think the player's size is something like "1.5 1.5 2.5", but I could be wrong.

Thanks much, I'll try it out.

A box search inside an interior like the Bedroom is no good.  Even if you're standing on the Bedroom floor, the box search will say that a interior is within the box because you're inside the interior object's world box.  You'll have to use raycasts for interiors, and maybe terrain as well.