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

Hi, 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.

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

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.

@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?

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:

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.

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