#How can i get parts in a random position within another part?
16 messages · Page 1 of 1 (latest)
add a magnitude check
but after i create the rooms? how would i do so every room has a magnitude check with every room except theirs? this is my code
accidentally typed a S but anyway
you do a loop that checks every room's magnitude with every other room and i guess if a room is too far or too close you could regenerate it at a random spot until its not too far or too close
** You are now Level 1! **
For the random inside of an area part: get the start and end of each vector value, and use math.Random(value1, value2) to get a value between the start and end points of the part
This is a really simple solution but there’s better ways if you’re doing this for a lot of parts
Alright
is this the only way or are there more efficient ones? it should probably work but what if there's the chance it just regenerates a lot because its going on the same place for a lot of times
at some point it will just generate at right spot and theres probably more efficient ways to do that but its a way
And you dont actually have to generate them you can just take the position the room is gonna generate at and already check
/opt/wandbox/lua-5.4.3/bin/lua: prog.lua:4: unexpected symbol near ':'
you just added a variable