How could i check touching parts inside a special mesh?

Im making a planetary system. These planets of course have their own gravity and sphere of influence, but the Earth is a sphere which is 2048 studs, so I can’t make a sphere of influence bigger and i figured out that special mesh can be bigger. Now I don’t know how to assign touched event to a moving special mesh. Thanks for any help!

2 Likes

Have you tried specialmesh:GetTouchingParts()?

It doesnt work with special meshes

This years RDC 23, Roblox did announce that mesh raycasting will be a thing. However, I don’t see it fully coming out for a long while. for now, you might have to use some hacky method by checking the spheres magnitude and whether the part is within it.

Assuming both parts are spheres, you can check if a part.pos+size/2 is within the radius(part.size/2) of another.

Do you mean constantly checking if player is within a specified distance from the sphere?

If that’s what you’re trying to check then yeah

I didn’t mention that I also need it to work on random parts entering the area.

Then check for those parts too. Im not sure how performant it will be if you have tons of parts that you need to check.

What about using a region3, will it less laggy?

Region3 will check within a 3D cube region. You’re checking to see if somethings within a sphere

Maybe there’s a way to make a part bigger than 2048 studs?