How can I place an object randomly within scene boundaries?

Everything is in the question. I’m having a gltf model I want to place randomly within the scene boundaries or let say within the viewable part of the scene ( camera related). How can I achieve this? thanks in advance.

1 Like

What do you mean by scene boundaries?

Approaching this problem with a grid based solution in mind would be a nice touch.
Divide your scene into a grid of imaginary cells of fixed size ( unit size equals to the size of the base of your object ). Now using raycast, you can figure out what cells of the grid are visible to your camera, assign index to each cell, get a random number within that index range and place your object there.

@Jiaqi by scene boundaries I meant the part of the scene viewable by user assuming the camera isn’t moving.
@mukarramsc Hum! thanks for your answer but I guess I really wanted to be randomly placed and not index based

anyway thanks for your interest, I’ve quitted the idea of placing randomly my objects