Need help with vector math to check if actor is inside a box area

I had really hoped I could figure this out on my own but I’ve had no luck in doing so. Can someone help me with the vector math needed to check if an actor is inside of a box area. I’m having to use GetAllActorsOfClass because this is a mod and the certain actors I’m checking for don’t have overlap events checked, otherwise I would of just used the box overlap to do this. Thanks to anyone that takes the time to respond, if I didn’t explain my question enough just tell me and I’ll try to explain it better.

1 Like

You can do this:


However, it will check for the actor’s origin, not if the entire actor is in the box.

4 Likes

You can just use a trigger volume and then get a reference to that and work from there.

Unfortunately it doesn’t appear my version of UE4 has the “Is Point in Box” node. I checked with context sensitive on/off and couldn’t find it. The version I’m using is 4.5.1, too bad it’s not in my version because it looks like it would work nicely.

You can do the same manually. Get the box location, get the box bounds, add the bounds to the location and subtract the bounds from the location, thus you’ll get two points in space, minimum and maximum. Then you check if your actor’s location is > minimum & < maximum, and if both are true, then your actor is within the box. In this case you can even account for the actor’s size by adding it to (subtracting from) the actor’s location when comparing it to minimum/maximum.

P.S. Why wouldn’t you upgrade to a newer version? There’s lots of cool stuff.

I tried my best to do what you said but I must of done something wrong since It’s not working right.

Huh, turns out you cannot compare vectors except for equal/not equal. Bummer. But that’s not a problem.

  1. You mustn’t get Vector Length. In this case it will show you how far your actor is from the 0,0,0 point in the world coordinates, no matter which direction.

  2. Here’s what I came up with. It may seem cumbersome, but it works.




In my case Cube17 is taken twice just not to make noodlesoup out of the blueprint. It’s one and the same actor. And you can use only one AND node with 6 pins, but it seems more comprehensible like this in my opinion.

It worked perfectly thank you so much for taking time out to help me with this. An about why I’m using an older version, it’s because I’m making a mod for a game so I have to use the same version the game does.

what Tuerer gave is helpful… in terms of using the function in background… if you cant spawn the boxes and trigger volumes… so if you have the bounds / vector locations stored and just want to “check by code” this is nice function :slight_smile: