Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you generate random Vector3 Positions within a specified range?

Asked by 5 years ago
Edited 5 years ago

So I am trying to teleport a brick to a random location on top of a brick, the bricks position that im trying to teleport the other brick on top of is

30, 0.5, -38

The brick is teleporting fine but what I need help with is generating a completely random location within the position of the brick that im teleporting the other brick too, the brick is of size:

78, 1, 68

The code for generating the random numbers is as follows:

x = r:NextInteger(100,30) / 10
y = r:NextInteger(0, 100) / 10
z = r:NextInteger(200, -38) / 10

My friend recommended me to use these parameters divided by 10 to get the random points inside of the brick. Any help is much appreciated :)

(r is the random object created earlier in the code)

Thank you

0
Sorry if my grammar is not that great or some of this might be confusing I am half asleep. If you would like me to clarify or post more code(i dont think you will need more code) then just let me know 4d61736f6e 59 — 5y

1 answer

Log in to vote
1
Answered by
mattscy 3725 Moderation Voter Community Moderator
5 years ago
0
Thank you I should have done more searching before I posted. Sorry I am half asleep. Thank you for the help :) 4d61736f6e 59 — 5y
Ad

Answer this question