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

The wiki is making me say: "wait, wooottt?"

Asked by 9 years ago

This page, on Region3's, confuses me before the third sentence. It shows the following code. Pay special attention to the comment.

Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) )
-- a Region3 with a size of (8, 8, 8) and a position at (5, 5, 5)

Why would it have a size of 888 and a position at 555? Shouldn't it be 111 and 999? This makes no sense, and the wiki doesn't explain.

More info on Region3 itself would also be greatly appreciated, as I didn't find that article very well written or clear.

3
The Vector3s in the first line define the corners. So a box with a corner at 1, 1, 1 and another corner at 9, 9, 9 would have each side be 8 and halfway between would be at 5 on all axes. GoldenPhysics 474 — 9y

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

Golden is correct.

The two parameters are not the Size and Position of the Region3, but rather the lower and upper corners of it.

9 - 1 == 8, and 8/2 == 4, 1 + 4 == 5, ergo: its position is 5, 5, 5 with a size of 8, 8, 8.


What specifically about that article did you have trouble understanding? The paragraph directly after that code block explains that you're defining the lower and upper corners of the Region3.

0
Ohhh thanks. One more thing, the wiki says that the second argument should be greater than the first. But what about negatives? Couldn't you make a box doing something like 'Region3.new(Vector3.new(0, 0, 0), Vector3.new(-10, 10, -10))' to make the box extend on the negative axis? ZeptixBlade 215 — 9y
0
0 is greater than -10, so that code would just error. Do you not understand how negative integers work? adark 5487 — 9y
0
No, I understand negatives. But if the second argument absolutely MUST be greater than the first, it seems like it would be pretty limiting, because you couldn't create a box with the position above. ZeptixBlade 215 — 9y
0
Yes you could. Look at the second example in the wiki page. adark 5487 — 9y
View all comments (2 more)
0
Thanks. What is the 'resolution' argument for this method? http://wiki.roblox.com/index.php?title=API:Class/Terrain/FillRegion ZeptixBlade 215 — 9y
0
The resolution of the Voxel terrain. ROBLOX requires it be 4 right now, the same as blocky Terrain's cube size. adark 5487 — 9y
Ad

Answer this question