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

check if a part is in bounds of another part?[SOLVED] [closed]

Asked by 5 years ago
Edited 5 years ago

im trying to figure out how would I know if a part is in bounds or inside a part. ive tried looking up questions about it, but none of them give a good answer than just "check if the position is in bounds of the part". If someone can give me an idea of how would i do that would be appreciated.

edit:

found a way to determine if its in bounds or not of a part:

local target = workspace.target
local corner1 = script.Parent.Position-script.Parent.Size/2
local corner2 = script.Parent.Position+script.Parent.Size/2

local function createPart(pos,name)
    local part = Instance.new("Part")

    part.Anchored = true
    part.Size = Vector3.new(2,2,2)
    part.CFrame = CFrame.new(pos)
    part.Name = name
    part.Parent = workspace
end

createPart(corner1, "1")
createPart(corner2, "2")

if corner1.Z <= target.CFrame.Position.Z and corner2.Z >= target.CFrame.Position.Z and corner2.X >= target.CFrame.Position.X  and corner1.X <= target.CFrame.Position.X then
    print("in bounds")
end
0
I'm not sure what you are trying to do here... ffejyos 10 — 5y
0
But...the question is answered... ffejyos 10 — 5y
0
look at my question again mate ilikepizzaboy13423 4 — 5y
View all comments (2 more)
0
The simplest ways would just to use gettouchingparts() or region3 ffejyos 10 — 5y
0
Use magnitude. DeceptiveCaster 3761 — 5y

Closed as Non-Descriptive by SerpentineKing and DeceptiveCaster

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?