Way to detect if point is in any part

As a Roblox developer it is currently impossible to detect if a point is in any part with 100% accuracy if we make the assumption that Roblox’s public API functions are 100% accurate


Currently there are 2 commendable methods you can try: Region3 and GetTouchingParts

Region3 is very inaccurate as it does bounding boxes and you can only search in 4x4x4 voxel buckets (with no extra pruning afterwards done by Roblox?)

GetTouchingParts could be amazing except for the fact that parts cannot be smaller than 0.05x0.05x0.05 (so this leads to some horrible bugs such as a complicated edge case I experienced when replicating the (deprecated?) Roblox .Position or .Shape which forced me to not support concave meshes)

Being able to raycast from inside parts and have a result that somehow states that the origin is within the part would be 11/10 but even a workspace:GetPartsAtPointWithIgnorelist(Vector3 position,int maxParts) would be amazing

Why is 0.05, 0.05, 0.05 too big? Why do you need to deal with replicating anything?

Also I’m pretty sure you can just make a ray with a really short length.

I scrolled through a lot of discord messages for this


its for a pet to stay above ground when terrain height changes
so i would check if point is in part then do rotated bounding box query to go above the part but if it might overshoot if its mesh/union/non rectangular prism primitive so then i would raycast down
problem is racasting has thickness 0
gettouching parts doesnt
so when pet is walking off edge
it willl infinitely go up and back down because of the difference in thickness resulting in game crash
(unless you say previously used parts cant be used again - although i realize now (or i probably realized before and just forgot lmao) that even if i didnt ignore with that method concave objects couldn’t be supported)

also i think you could argue that in general GetTouchingParts is a bad idea

and @EchoReaper asked long ago so maybe he has a use case

how mister

Just went looking and found this thread from 2017, which is a duplicate of this one.

Also, you could use EgoMoose’s Rotation Region3 to satisfy your bounding box woes.

2 Likes

rip

just by looking at what calls it does to roblox api (findpartsinregion3) i know it cant handle meshes and csg

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.