Random point in rotated box

Hi guys,
need your help, I’m having difficulties trying to pick random points inside a rotated box.
Here’s the situation:

The camera is upside down (for complex and not modifiable reasons) and GetComponentsBounds / RandomPointInBoundingBox do not seem to take rotations in consideration.
Has any of you worked on something similar or has any idea to help me figure this out?
I would really appreciate it.

Generate a point as your box would be centered in 0,0,0 and with no rotation - just a random vector in range/bounds or what ever it’s called. Or you can always just generate 3 random floats in range and make vector out of them.
Then do a Transform(RandomPoint, GetActorTransform(Box)) this will translate your point into a world space aligned with box. You need to use TransformLocation node for this.

I’m not sure I grasped what you suggested, but maybe it’s because it’s late and I’m tired.

The point I should randomly get, should be in a box of the same size as the rotated one, right?
Then I should do as in this picture? With T being GetWorldTransform of the Collison Box component, and Location being the random point in the surrogate box?

1 Like

Exactly but put origin input as 0,0,0

1 Like

Yes, it made lot more sense in the morning :smiley:
It worked perfectly.
Thank you very much BoredEngineer.

I need to hunt you down and buy you a beer, I have been stressing on this for the last 2 days. Thank You