How to get Object edges considering orientation

Hello everybody.

I’m making an object identification system outside a specified area through three-dimensional Vectors, I’ve been having problems identifying objects outside the area in which they have a rotation in which they make the object misaligned and thus occupy a space outside the area specified by the vector.

Below is a code example in which I am mentioning.

local Area = {
    Position =, 0, 80), -- Ignore the Y axis.
    Size =, 0, 100) -- Ignore the Y axis.

local Object ='Part', workspace)
Object.Size =, 0, 10)
Object.Position =, 0, 0)
Object.Orientation =, 45, 0)

local XAxisEdge = Object.Position.X + Object.Size.X/2

--[[ The XAxisEdge variable does not handle the orientation, which means that it will not be possible to check if it is outside the area correctly. ]]

Thank you very much in advance! :grinning:

1 Like

Same thing as you wrote but for XAxisEdge you could get it relative to the object’s cframe like this:

local XAxisEdge = Object.CFrame:PointToWorldSpace(, 0, Object.Size.Z/2))

However this will return a vector3 value of that edge.

local XAxisEdge = Object.CFrame:PointToWorldSpace(, 0, Object.Size.Z/2))
1 Like