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

What is the purpose for Region3?

What is and how will you use Region3 in game?

1 answer

✓ Accepted answer

Region3: is used to represent a size and a location in 3D space. Think of a part that is x,y,z in size. The Region3 would be this part's position and size. It's like an area.

Region3 setting: can be created with the Region3.new constructor, which receives two Vector3 values Example:

region = Region3.new(Vector3.new(), Vector3.new())

Since this region is a cube, and that you only can set two points, the Region3 cannot be rotated (Say a diamond region).

Knowing the above sentence, we infer that the two points are two corners where the first Vector3.new() is the first point and the 2nd the 2nd point.

When a Region3 is created, it moves the select box and creates it's own size and position for checking inside scripts.

Now with the region say, you created one.

region = Region3.new(Vector3.new(1,1,1), vector3.new(5,5,5))

We can get the CFrame and move parts based on the region and rotate them from there - the function of Region3.

part.CFrame = region.CFrame * CFrame.Angles(math.rad(90),0,0)

It also returns the size as so:

part.Size = region.Size

3 comments

2

I wouldn't mind an upvote...

0

A Region3 describes a volume, not an area ;)

1

Yes, I explained that.

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