Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

1 comment

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.

1 answer

✓ Accepted answer

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.

6 comments

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?

0

0 is greater than -10, so that code would just error. Do you not understand how negative integers work?

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.

0

Yes you could. Look at the second example in the wiki page.

0

Thanks. What is the 'resolution' argument for this method? http://wiki.roblox.com/index.php?title=API:Class/Terrain/FillRegion

0

The resolution of the Voxel terrain. ROBLOX requires it be 4 right now, the same as blocky Terrain's cube size.

This discussion is preserved as it was. New answers, comments, and votes are closed.