Randomly Spawning Objects Based On Other Parts In A Map

I’m trying to write some code that spawns powerups on the map, but I’ve ran into an issue.
You see most of my map isn’t flat, it has curves and such, i want powerups to be able to spawn anywhere while it looks seamlessly like its just barely floating above said object. Is there any way I can do this?

I have no code as I did research first and couldn’t find anything.

2 Likes

You could create a bunch of pre-defined locations inside of a folder in the workplace, and every so often randomly selects a number from the quantity of items in that folder then set the powerups location to that of the number chosen.

3 Likes

Simple, use raycasts from said object that shoot a ray downwards then use the position from the raycast result plus what ever additional positioning. When it comes to the random positioning. Jusr find the maps position (as in the maps positional value) or add a attachment in the center of the map then do a math.random() with the vector values of the map (as in X and Z)

3 Likes

I was about to say I figured it out, and this is exactly what I was going to do lmao, after finding a post in relation to this.

ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries was also going to use this as well.

Thank you however!

1 Like

Yeah that could work too, but my idea went for a more of random objects on the map approach.

1 Like

I use that exact approach but when I think “vertical” map im thinking of some mountains and overhangs and what I have experienced in my system was the crates (in my case) would get stuck, especially because I was using mesh-based terrain and deformation with its own set of physics.