# Region3 is off for some parts

I am making a game with guards that walk around. There is a part in front of the guard which lets you see how far the guard can see that uses region3, however, with my script, regions get off on some guards and perfect on other guards. I use the same line for every guard

``````Region3.new(Guard.Box.Position - (Guard.Box.Size/2), Guard.Box.Position + (Guard.Box.Size/2))
``````

anybody know how i can fix this?

on point for most guards

off for this guard

orientation really throws it off, i needed to switch the x and z size then rotate the part

This is because you are only offsetting from position.

You should use CFrames:

``````Region3.new((Guard.Box.CFrame*CFrame.new(-Guard.Box.Size/2).p, (Guard.Box.CFrame*CFrame.new(Guard.Box.Size/2)).p)
``````

CFrames include rotation in the form of a LookVector.
The LookVector is just a vector representing the direction of the CFrame.

``````CFrame.new(pos, lookPos)
-- Is the same as
CFrame.new(pos, pos+lookVector)
``````

Multiplying CFrames is like adding them. To subtract a CFrame you use CFrame:Inverse():

``````cf1 * cf2:Inverse()
``````

To create a CFrame from angles you use this:

``````CFrame.Angles(math.rad(180), 0, math.rad(95)) -- math.rad converts degrees to radians. Radians are what CFrame.Angles takes unlike Part.Rotation
``````

When multiplying CFrames:
Negative Z is forward
Positive Z is backwards
Positive X is left
Negative X is right
Positive Y is up
Negative Y is down

These are relative to the partâ€™s faces. The lookVector represents the forwards look direction in a unit vector (a vector with a total distance aka magnitude of 1)

If the part is looking in the positive Z direction its lookVector would look like this:

``````Vector3.new(0, 0, 1)
``````