PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

ArePartsTouchingOthers

ArePartsTouchingOthers returns true if at least one of the given BasePart are touching any other parts. Two parts are considered “touching” if they are within the distance threshold, overlapIgnored.

If no parts are provided, false is returned.

Parameters

Name Type Default Description

A list of parts checks to see if any parts in the list are touching any parts not in the list

0.000199999995

The part overlap threshold in studs that is ignored before parts are considered to be touching

Returns

Return Type Summary

True iff any of the Part|parts in partList are touching any other parts (parts not in the partList). False if no parts are passed.


Code Samples


Checking for Touching Parts

The code block below demonstrates how to use WorldRoot/ArePartsTouchingOthers to check if parts in a list are touching any parts in the workspace not in the list.

First the script creates two square parts that overlap 1 stud, Part1 and Part2. Then, it prints the value returned by ArePartsTouchingOthers() when Part1 is passed in partList at three different overlap values: 0, 0.999, and 1. The first two times ArePartsTouchingOthers() is called return false because the overlap values are less than the distance that Part1 and Part2 overlap. The third call returns true because the overlap value is equal to the distance that the parts overlap.