-Random Point In Box- node orientation always default zero in world. How can I change this

Hi, I have made an Actor Spawning Blueprint which consists of a -Spawn Actor from Class- node, a -Box Collision- and a -Random Point In Box- node oriented to the Default Scene Root. I get the extent of the box and pass the vector along to the spawn location of the -Spawn Actor from Class- node. Everything spawns, however the area in which the actors spawn, based on the Extent of the Collision Box, is oriented to the Default World Coordinates of 0,0,0 and not the defined Z orientation of the blueprint. Why is this and how can I change it to orient the spawn area in the rotation desired?

THX!

1 Like

It’s your code, not the node :wink:

image

Thanx for your quick reply, however even when using your code it is still not working. The -Random Point In Box- node asks for origin which is the Location of the bounding box but not the rotation of the bounding box. Is there a way to add the forward vector so that it knows where the box is facing?

If I use your code and rotate the bounding box in the world space the spawn area is still oriented to world rotation 0,0,0,. This is very visible when spawning 1000 or more actors. The bounding box (Outlines) is facing in the desired orientation but the spawned actors are oriented as a block (because there are so many actors being spawned) in the ,0,0,0 orientation.

what am I doing wrong?

1 Like

I’m not talking about rotating each individual actor. I want the whole spawn area facing in the right direction. Example. I have a model of a pool facing 35 degrees on the Z axis in world space. I want to fill this pool wit 1000 Balls (Actors). Even though the bounding box is oriented and scaled exactly to fit inside the pool, when spawned some of the balls are in the pool but there are also lots not in the pool. This is because the box extent is oriented to 0,0,0. and not 35 degrees on the z Axis.

It really depends if you’re rotating the actor, or just the box.

If it’s the actor, then my solution will work.

If you’re rotating the box, but not the actor, then you can get the world rotation of the box, that should do it.

I can’t try until tomorrow…

Did you get this working?

I don’t know if its a bug in unreal but I can’t get the actors to spawn within the box. see screenshot

Maybe someone knows what the problem is.

THX!

1 Like

Can you show your code?

Are you using the Construction Script for this? Trying to read the transform of the box collision and use its data for the random gen?

@ClockworkOcean You helped me once with this.


@Pilleman22 Could you have a look and tell if this lines up with your experience:

1 Like

I think it must have to do with it NOT being called from the construction script. My suspicion is that the -RANDOM POINT IN BOX- node was meant to only be used in the construction script. (My Code Below)

I also noticed that the SPAWN ACTOR FROM CLASS node doesn’t work in the construction script, so using the construction script in my case is not an option. I also don’t know the location of my ACTOR SPAWNER BP before loading and it is set after the level has been loaded.

I’ve noticed a similar issue when using WORLD ALIGNED TEXTURES MATERIALS. The texture displayed is always oriented to X=0, Y=0, Z=0 and I still haven’t found a way to change the Z Rotation.

You have to add the box rotation in, like I did above. That’s the problem…

If I use your code I still get the same result. The box Z rotation =0 even though it is set to Z=43.

Can you show the code you get from that? Thanks.

I am using your code. See screenshots. THX!



Are you changing the rotation of the actor ( the blueprint ), or are you selecting the box and moving that?

I tried both. once turning it in the level and once in the blueprint. both have the same result.

1 Like

If you rotate the actor it works. I don’t get it… ( the box should be unrotated in the blueprint )

what do you mean with the box should be unrotated in the blueprint? do you mean it should be set to 0,0,0 in the blueprint?

I’m using UE 4.27. Could this have anything to do with it?

Yes, the box should be at rotation 0,0,0 in the blueprint.

I don’t think using 4 should affect things…