x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Game Mod
Tags:
more ▼

asked Dec 03 '18 at 07:09 PM in Blueprint Scripting

avatar image

LingeringGhost
3 1 1

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You can do this: alt text
However, it will check for the actor's origin, not if the entire actor is in the box.

box.png (79.4 kB)
more ▼

answered Dec 03 '18 at 07:23 PM

avatar image

Tuerer
643 2 6 8

avatar image LingeringGhost Dec 03 '18 at 10:04 PM

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.

avatar image Tuerer Dec 04 '18 at 06:28 AM

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.

avatar image LingeringGhost Dec 06 '18 at 07:05 PM

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

ue4screenshot01.png (180.1 kB)
avatar image Tuerer Dec 06 '18 at 07:19 PM

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. alt text

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.

isinbox.png (232.3 kB)
avatar image LingeringGhost Dec 06 '18 at 08:42 PM

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.

(comments are locked)
10|2000 characters needed characters left

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

more ▼

answered Dec 03 '18 at 09:33 PM

avatar image

xd RedBallG
80 1 1 5

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question