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

How exactly does Region3.new() create a Region3 from two Vector3 values?

Asked by
nc2r 117
4 years ago

It says that it creates it from two vector3 values, but how? are these opposite corners, or a position and a size? or what?

2 answers

Log in to vote
3
Answered by
starmaq 1290 Moderation Voter
4 years ago

If you think about it a bit, Region3 is basically an area in 3D space, and to define that area we need two Vector3s. And as you said, those two Vectors are basically the two opposite corners. Because it turns out that if we just know the location of those two coners, we can know all the dimensions of that area (the heigth, the length, the width).

This image would make everything clear.

The height would be the absolute value of the y of A, the length would be the would be the absolute value of the x of B and the width would be would be the absolute value of the z of B. It's the absolute value because distance and lengths can't be negative, so if B.x was negative it wouldn't work out, we need its absolute value.

Ad
Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

Imagine a box that has 8 corners. Imagine a corner on the box. Now imagine the opposite corner of the box. Imagine the lines of the box. The x cord meets the other corner's x cord. Then a point gets set where the points meet. Then the same goes to the z,y. Then the points get drawn to each other whit a straight line. And then the opposite side of a point gets another point. Let's say a cord of (10,10,10). Then there comes an opposite point (-10,-10,-10) And then this point gets connected whit the other points. Then all of the points become a 3-dimensional figure. It's basically a new box. And then that box becomes a region.

A bit hard to explain in text. But if you would like for me to explain it to you whit video. Then just tell me:=)

0
good explanation! starmaq 1290 — 4y
0
Thx. You had a much more detailed one tho:=) Skydoeskey 108 — 4y

Answer this question