You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to find a method that allows me to detect certain parts which cannot be detected except in a square using Region3 (seemingly).
What is the issue? Include screenshots / videos if possible!
Region3 doesn’t work, if I understand it correctly, it only detects within a square.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Still looking. I looked for solutions for my problem but I didn’t find any. I don’t need anyone to script it, would just like a point in the right direction.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
You could do a magnitude check, and then do some math to see if a part is in a sphere.
Edit: Here is a code example:
for i, v in pairs(workspace:GetDescendants()) do
if v:IsA("BasePart") then
local magnitude = (v.Position - Sphere.Position).Magnitude
if magnitude <= (Sphere.Size.X + Sphere.Size.Y + Sphere.Size.Z) / 3 then
-- Boom. Part is in the sphere
-- Do something...
I haven’t, but when I create a sphere part it is surrounded by the square highlight, which exceeds the physical sphere and was confused. Will the GetTouchingParts() include the parts that are also inside that highlight/selection or just within the physical sphere?
What are you talking about? Every can collide true part has a touched event. In games there might be thousands of them! Please don’t blabber out of nowhere(sorry for being rude). The reason I didn’t disconnect it is because they might have to run the function the whole game.
@WarInEuropeRBLX If there are many tiles, using the GetTouchingParts() method would be better, unless you are only using magnitude occasionally. Imagine looping through 100 parts every second. But it won’t cause much of a difference.
The sphere will be created once and will run only to detect 19 particular parts within itself. It wouldn’t take a lot of resources, I think, but it would be best for the game, practice, and familiarity.
The sphere will afterwards be deleted after the detection, as it would no longer be used.