Download

How to check if an object is entire into a box collision?

hello, as the title says, i need to check if a box is entire in a location, i’m using a box collision to know when the box is on the location, but i need to check if the entire box is into the box collision, is there a way to check this ?

thanks in advance for all the help

If its always going in the same direction you could just place the collision box of the item far enough in the back. At the time its overlapping the actual box is somewhere further in the front.

Or make it bigger and work with “on end overlap”

You could work with locations, maybe make distance calculations

or use 2 collision boxes - 1 front 1 behind, when both entered you sure are within your desired location.

many ways to approach this

1 Like

thanks for the info @Zvenzo

You would have to run several traces to determine the impact points all around.

There are nodes to check an area like you want. Nor can there be really.

A viable alternative is to make the container box have 6 colliders, one for each side.
Then you can know an object is inside it when the container overlaps, but the external ones do not collide.

In practice, if you have an actual box to trace against, running a line trace from the object would be faster.
The difference though is that the trace is a single point, and tracing a sphere or a box ends up costing more than having the container have 6 extra colliders.

The fastest possible way is to just do the math.
Collide with the container.
get the container bonds and x2 for it’s size.
get the object location. get the box size of the object.
do the math to check that the box is contained based on those parameters.

No traces. no bs. and even a mobile CPU will complete the calculations in milliseconds…
It also works from engine bounds, so it’s probably more accurate than a single line trace.

You have to check each vert of the bounding box. that’s 8 calculations per object.
16 calcs for 2 boxes…