I want to generate a position for objects in random manner and i don’t want them to overlap with each other .
my screen width is 4.8 meter and height is 9.6 meter and the object width is 0.5,and height is 0.5 meter .
can any one put me on the right direction ,or any suggestion .
regards
If you can live with your “random” object positions being on a grid, then you can divide the space into 0.5 meter by 0.5 meter squares and pick a square. Your world is 9.6 meters by 4.8 meters. So you have a grid that is 19 x 8.
Put all of the grid positions into a list. For each object that you want to place, randomly pick a grid position from the list and remove it from the list.
If you want to avoid the strict grid appearance, you can alter the x and y positions of your grid centers slightly (add a little here and there). Logically you still have a grid, but the appearance would be less regular.