Are there any quicker and more efficient part.Touched alternatives? because I’m using part.Touched in a script where you throw an object at high speeds but sometimes theres a delay before part.Touched fires.
The script should destroy the part after it hits the ground and it does destroy… but with a kinda delay.
–Video Example
Don’t know why theres that delay, anyone have any ideas?
local TableOfParts = {}
game:GetService("RunService").Stepped:Connect(function()
for i, v in TableOfParts do
--check the distance between the parts u want to check getting touched and the parts that will get destroyed when touched by these parts
end
end)
im not sure how are u going to check if its touching though, maybe raycast? and minus the size of them so u see the exact distance between the surfaces of each part, or maybe do a double raycast, from first part then to second part using the position of the first raycast result, so its more accurate, and just check if the distance between these 2 using magnitude is less than 0.1
Part.Touched can be delayed if you’re listening to the touched event from the server but the part is owned by a player. If you were to set the part’s network owner to the server and listen to the touch event from the server, there would be no delay between visual collision and the touch event.
Regarding performance however, touched events only bring down performance when you’re detecting more than a few collision objects. judging by the video, you’re only listening for collisions on a projectile, which shouldn’t bring performance down very much on its own.
If you need to detect collisions for alot of objects, I would suggest using collision groups and if possible, disable collisions between projectiles.
i mean for anything that requires any sort of accuracy at all i just go to workspace:getpartsinpart(boundingpart) and it returns a table with every single part that is colliding with the boundingpart (for the object that is being destroyed)