I will like to spawn many object at random locations in a map (Similar to COD:sweat_smile: when players respawn) but i dont wanna use the “Empty object” to mark places around the map. Instead i want to use the Inside of a cube or sphere as spawn area but i need a code that will calculate the vectors in the area and randomly spawn an object in any location in that given area. I think i have got an idea on how to face this problem jst now but any opinion counts. Thanks
I just finished trying what i had in mind…it didn’t work. Pls help
Use a hidden mesh for placement and uncheck ‘camera’ in properties>>object>>visibility.
For finer control, designate a vertex group, or a texture.
If you read what i wrote above, you will know that i spoke about something Similar (when i spoke about “Empty Objects”) and that I don’t wanna use it.
Please what do you mean by “normalise for radia”
Normalizing the vector means you make the length of it 1.0, so it doesn’t gives location outside the radius. If the area is a square, you don’t have to normalize it.
I’ll point out that Daedalus code will give locations at the radius (*20), not inside of it. For random locations inside the area you should change the line to:
pos = Vector([rx,ry,0]).normalized()*logic.getRandomFloat()*20.0
Thanks this was what i was looking for.
yes, you are right, stupid of me. ill try to remember to resist posting here.
No you shouldn’t have deleted it. That hrlped me as well. In fact yours was the reason my question was answered. Please post it back🥺