I am using :GetTouchingParts() to create a spreading fire effect but am running into a problem where none of my parts are actually colliding with each other.
https://gyazo.com/12a49fd9d60436cdc58101b2ee39f7e9
However, above is what happens when I build normally and with collisions on. Roblox does not recognize the parts as touching and therefore the fire does not spread.
My question is, how can I build so that Roblox recognizes all my parts are touching each other without making sure each individual part is colliding correctly. I built this with 1 Stud movement and duplicated the original part when needing a new part.
Whenever I try to put two parts together using collision, it is not touching each other 100% of the time. Have you checked if the parts are actually together?
If not, try my way of putting parts together:
Use the ResizeAlign plugin
Select the sides you want to connect to each other
If you are concerned about the size, scale the opposite side of the block using .01 movement until you get the size you want.
I’ve encountered this problem before, and i can say from experience that @Mack_ii his steps seem like the most reasonable way of doing it.
Give his steps a try and if they don’t work try this
If you’re using getTouchingParts(), I don’t believe that parts merely ‘touching’ each others’ surfaces is enough. They need to be intersecting (CORRECT ME IF I AM WRONG!). I’d rather use rays, or just compare parts with it is surrounding to decide whether it should get caught on fire.
Edit:
I actually went ahead and checked whether I was right about GetTouchingParts(), it turns I was right. Parts need to be intersecting, not ‘touching’ by gracing their faces.
Do you know of any other methods I could use to find the touching parts? I know you mentioned rays and comparing parts but i’m not sure how I would go about using those for this, if you could maybe explain a way I could use it (don’t expect you to write out any code for me).
It might be better to use Region3. Have it detect parts within a region3 of the parts size + Vector3.new(1,1,1). This will give you a half stud gap to work with which will allow parts that aren’t touching but are reasonably close to set aflame. The only downsize is that this may not work as well with some things like Unions and other part types.
This has been done numerous times before, the most popular solution is duplicating a part (an invisible one that acts as a hitbox )and make it bigger and then use GetTouchingParts(). I believe it was @Zairky that came up with this (or at least presented it in a devForum post) that I’ve read before. //Sorry about the ping if it wasn’t you.
You basically just need two functions.
Function A) createBiggerHitbox
//This is supposed to take the part you need and simply making it a bit bigger.
so like
local function bigHitbox(part)
local newPart = part:Clone()
newPart.Parent = parent
newPart.Size = part.Size + Vector3.new(0.2,0.2,0.2)
newPart.CFrame = part.CFrame
return newPart
end
and then I trust that you’re capable of making a getTouching function.
local function GetTouching(object)
local bigboiHitbox = bigHitbox(object)
-- code for the touching function
return touchingParts
end
No, the thing is that the getTouching method only interact with intersecting parts, and that is a good thing They should however implement a method to check touching surfaces :oo