Performant geometrically accurate collision detection

As a Roblox developer, it is currently too hard to performantly do collision detection which is also accurate to collision geometry. GetTouchingParts is the only way to do geometrically accurate collision detection, but it is not even remotely performant, raycasts can be used to do highly inaccurate, but performant collision detection, Region3s can be used to do very very fast collision detection, but cannot be rotated and are locked by a 4x4x4 grid making them almost useless for collision detection, Touched and TouchEnded are both extremely unreliable, and, a feature such as BoxCasting could be used to perform fast collision detection, but, of course, would be limited to boxes.

The problem is simply this, Roblox does not support any way to check if two objects are intersecting without either A. costing a very large amount of CPU time making it inconvenient to use repetitively or per frame even with very heavy lua optimization, or B. heavily sacrificing in the accuracy of detail, orientation/scale, position, timing, or reliability.

If Roblox is able to address this issue, it would improve my development experience because it would allow me to create highly performant collision checks for object placement such as preventing objects from intersecting eachother, detecting if players enter or leave certain areas, rooms, etc using custom zone meshes, doing accurate detection of collisions for things like swords rather than relying on something very inaccurate that clients can usually abuse, detecting when a monster can hit a player by giving it a special hit collider, and a lot more.

BasePart:GetTouchingParts()'s functionality should be extended to support detecting collision in the same way that RayCasts currently do and should support similar whitelist, blacklist, etc features, should support ancestors like raycasts do, and should skip out on checks like that altogether when it can. For example, workspace:CheckIntersections(intersectionOptions).

A feature like this should be as customizable, and as powerful as raycasting so that it would apply to a very wide variety of games.

I think that, for forwards compatibility and the possibility future performance improvements collider information could be passed on an options instance. Roblox can then do anything (or nothing) with this collider information, for example, generating more simplified collision geometry to improve performance of these checks.

9 Likes

It looks like something like this may already be coming down the pipeline.

If the type names are anything to go by, OverlapParams may hopefully allow for the fine grained customization you suggest.

5 Likes

:flushed:

Unfortunately, it looks to be an alternative form of GetTouchingParts in some ways. What I really would like is a way to specifically check if some given parts collide with some other given parts.

(Also, it looks like its similar to BoxCasting and SphereCasting which was confirmed, except, rather than a BoxCast/SphereCast its an intersection check, maybe its a predecessor)

Turns out it is? (Maybe?)

2 Likes