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"

Stop "Random Point in Bounding Box" to return Negavtive values on X,Y,Z direction

alt textHi, I'm trying to drop characters inside a box at random points using "Random Point in Bounding Box". But the problem is that this function is throwing some "Negative" values on return which are causing to generate characters below the box. Any solution how to avoid that negative values on X, Y, Z direction or turn them into positive values so that these weird below-growing things just get solved? I'm new in UE4, so kindly pardon my mistakes.

Product Version: UE 4.19
Tags:
2018-04-27.png (113.0 kB)
more ▼

asked Apr 27 '18 at 01:29 PM in Using UE4

avatar image

Gazzali Fahim
5 1 3 7

avatar image ThompsonN13 Apr 27 '18 at 02:08 PM

i imagine part of your box is below ground so to speak and thats why your spawning things so low. if your working with a blueprint then you could move your collision box upwards so that the bottom of the box is in line with the blueprint root in essesnce moving the origin, this requires that the collision not be the root though which can be solved by adding in a scene component. if you really wanted to get rid of the negative numbers you could but that would leave you with only spawning items in 1/4 of the total box area (if you modified all axis). if you wanted to only modify the z axis then i would recommend using the absolute node, to use this you will need to break your vector so it gives 3 float values then hook the absolute node to the axis you want to change z for example then recombine the vector. another solution is to move your box so its entirety is above ground.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You can do many things:

  • since the Origin depends on the box' location, you can position the Portal Box above ground

  • you can add Z offset to GetWorldLocation -> add a vector whose Z is equal to 1/2 box' Z

  • you can run the Z coming out of the Random Point in Bounding Box through an ABS (absoloute) node - it returns positive values only

  • you can run the Z coming out of the Random Point in Bounding Box through a Clamp node and accept only positive values; in this case, whenever a value is below 0, it gets clamped to 0

more ▼

answered Apr 27 '18 at 01:43 PM

avatar image

Everynone
15.3k 77 26 62

avatar image Gazzali Fahim Apr 27 '18 at 02:42 PM

@Everynone, Thanks for your help, ABS (float to vector) seems to works. But it takes only one float to absolute to vector,. Do you know any method to combine X, Y, Z's three different values into one and return to location as a vector form?

avatar image Everynone Apr 27 '18 at 02:54 PM

I may not fully understand what you're trying to achieve but you probably do not want to adjust X,Y as you'll be introducing a horizontal offset that would push the results off-centre.

You could use the ABS like so:

alt text

As ThompsonN13 mentioned in his suggestion, you can right click the vector pin and split it; this will give you access to the elements that make the vector.

untitled.png (130.5 kB)
avatar image Gazzali Fahim Apr 27 '18 at 03:16 PM

@Everynone, Thanks a lot !!! This one actually helped me solve my problem !!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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