Timeline for Instantiate two objects at random non-overlapping positions
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 14, 2018 at 14:58 | comment | added | DMGregory♦ | OP included randomization in their code example. This is not at all unusual for endless runner games. What I'm getting at is I don't think this answer as written fully addresses the question that was asked, and I'd recommend editing it to give a more complete description of how you propose to solve the overlap problem with randomly selected spawn positions. | |
Jul 14, 2018 at 14:51 | comment | added | Prometheus | OP said: "I have the script that make coins and walls appear at the same time in front of the player.". He also stated that he: "I'm making an endless runner game.".So high randomized position wouldnt make sense at all, otherwise it would be probably impossible to catch them? I think OP wants most likely to randomize the x position and maybe slightly the z, this can be done very easily and he simply needs to make sure that the randomized position are never higher than the distance between both spawning points, which is quite easy to do with this method since both points are static. | |
Jul 14, 2018 at 14:32 | comment | added | DMGregory♦ | And given that the two positions are randomized, how do you ensure the randomized positions don't overlap? | |
Jul 14, 2018 at 14:28 | comment | added | Prometheus | Simply add another spawn point, adjust position either via editor or via code and spawn obj1 at pos1, obj2 at pos2. | |
Jul 14, 2018 at 12:52 | comment | added | DMGregory♦ | This answer shows how to spawn one object, but not the second object. Do you have a recommendation for how to spawn both without the two overlapping one another? | |
Jul 13, 2018 at 21:20 | history | answered | Prometheus | CC BY-SA 4.0 |