WorldRoot
Base class for handling physics simulation and 3D spatial queries.
Memory category | PhysicsParts |
---|
Member index 25
Removed member index 1
History | Member | |
---|---|---|
427 | IkMoveTo(part: Instance, target: CFrame, translateStiffness: float = 1, rotateStiffness: float = 1, collisionsMode: CollisionsMode = OtherMechanismsAnchored): void |
Description
This base class provides an API for any instance intended for handling 3D spatial queries and simulation, such as Workspace and WorldModel.
History 114
- 648 Change ReturnType of findPartsInRegion3 from Objects to Instances
- 648 Change Parameters of StepPhysics from (dt: float, parts: Objects = {}) to (dt: float, parts: Instances = {})
- 648 Change Parameters of IsRegion3EmptyWithIgnoreList from (region: Region3, ignoreDescendentsTable: Objects) to (region: Region3, ignoreDescendentsTable: Instances)
- 648 Change ReturnType of GetPartsInPart from Objects to Instances
- 648 Change ReturnType of GetPartBoundsInRadius from Objects to Instances
- 648 Change ReturnType of GetPartBoundsInBox from Objects to Instances
- 648 Change Parameters of FindPartsInRegion3WithWhiteList from (region: Region3, whitelistDescendantsTable: Objects, maxParts: int = 20) to (region: Region3, whitelistDescendantsTable: Instances, maxParts: int = 20)
- 648 Change ReturnType of FindPartsInRegion3WithWhiteList from Objects to Instances
- 648 Change Parameters of FindPartsInRegion3WithIgnoreList from (region: Region3, ignoreDescendantsTable: Objects, maxParts: int = 20) to (region: Region3, ignoreDescendantsTable: Instances, maxParts: int = 20)
- 648 Change ReturnType of FindPartsInRegion3WithIgnoreList from Objects to Instances
- 648 Change ReturnType of FindPartsInRegion3 from Objects to Instances
- 648 Change Parameters of FindPartOnRayWithWhitelist from (ray: Ray, whitelistDescendantsTable: Objects, ignoreWater: bool = false) to (ray: Ray, whitelistDescendantsTable: Instances, ignoreWater: bool = false)
- 648 Change Parameters of FindPartOnRayWithIgnoreList from (ray: Ray, ignoreDescendantsTable: Objects, terrainCellsAreCubes: bool = false, ignoreWater: bool = false) to (ray: Ray, ignoreDescendantsTable: Instances, terrainCellsAreCubes: bool = false, ignoreWater: bool = false)
- 648 Change Parameters of BulkMoveTo from (partList: Objects, cframeList: Array, eventMode: BulkMoveMode = FireAllEvents) to (partList: Instances, cframeList: Array, eventMode: BulkMoveMode = FireAllEvents)
- 648 Change Parameters of ArePartsTouchingOthers from (partList: Objects, overlapIgnored: float = 0.000199999995) to (partList: Instances, overlapIgnored: float = 0.000199999995)
- 640 Change Parameters of GetPartsInPart from (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 640 Change Parameters of GetPartBoundsInRadius from (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 640 Change Parameters of GetPartBoundsInBox from (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 638 Change ReturnType of Spherecast from RaycastResult to RaycastResult?
- 638 Change ReturnType of Shapecast from RaycastResult to RaycastResult?
- 638 Change ReturnType of RaycastCachedTerrain from RaycastResult to RaycastResult?
- 638 Change ReturnType of Raycast from RaycastResult to RaycastResult?
- 638 Change ReturnType of Blockcast from RaycastResult to RaycastResult?
- 616 Add StepPhysics
- 603 Add Shapecast
- 573 Change ReturnType of SetInsertPoint from void to null
- 573 Change ReturnType of IKMoveTo from void to null
- 573 Change ReturnType of BulkMoveTo from void to null
- 572 Change ThreadSafety of Spherecast from Unsafe to Safe
- 572 Change ThreadSafety of Blockcast from Unsafe to Safe
- 569 Add Spherecast
- 569 Add Blockcast
- 553 Change PreferredDescriptor of findPartsInRegion3 from to GetPartBoundsInBox
- 553 Change PreferredDescriptor of findPartOnRay from to Raycast
- 553 Change PreferredDescriptor of IsRegion3EmptyWithIgnoreList from to GetPartBoundsInBox
- 553 Change PreferredDescriptor of IsRegion3Empty from to GetPartBoundsInBox
- 553 Change PreferredDescriptor of FindPartsInRegion3WithWhiteList from to GetPartBoundsInBox
- 553 Change PreferredDescriptor of FindPartsInRegion3WithIgnoreList from to GetPartBoundsInBox
- 553 Change PreferredDescriptor of FindPartsInRegion3 from to GetPartBoundsInBox
- 553 Change PreferredDescriptor of FindPartOnRayWithWhitelist from to Raycast
- 553 Change PreferredDescriptor of FindPartOnRayWithIgnoreList from to Raycast
- 553 Change PreferredDescriptor of FindPartOnRay from to Raycast
- 552 Add RaycastCachedTerrain
- 552 Add ClearCachedTerrain
- 552 Add CacheCurrentTerrain
- 549 Change Parameters of Raycast from (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 549 Change Parameters of GetPartsInPart from (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 549 Change Parameters of GetPartBoundsInRadius from (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 549 Change Parameters of GetPartBoundsInBox from (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 512 Change Tags of IsRegion3EmptyWithIgnoreList from [] to [Deprecated]
- 512 Change Tags of IsRegion3Empty from [] to [Deprecated]
- 512 Change ThreadSafety of GetPartsInPart from Unsafe to Safe
- 512 Change ThreadSafety of GetPartBoundsInRadius from Unsafe to Safe
- 512 Change ThreadSafety of GetPartBoundsInBox from Unsafe to Safe
- 512 Change Tags of FindPartsInRegion3WithWhiteList from [] to [Deprecated]
- 512 Change Tags of FindPartsInRegion3WithIgnoreList from [] to [Deprecated]
- 512 Change ThreadSafety of FindPartsInRegion3 from Safe to Unsafe
- 512 Change Tags of FindPartsInRegion3 from [] to [Deprecated]
- 509 Change Parameters of Raycast from (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 509 Change Parameters of GetPartsInPart from (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 509 Change Parameters of GetPartBoundsInRadius from (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 509 Change Parameters of GetPartBoundsInBox from (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 492 Change Parameters of GetPartsInPart from (part: Instance, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 486 Change ThreadSafety of Raycast from ReadOnly to Safe
- 486 Change ThreadSafety of FindPartsInRegion3 from ReadOnly to Safe
- 483 Change Parameters of IKMoveTo from (part: Instance, target: CFrame, translateStiffness: float = 0.5, rotateStiffness: float = 0.5, collisionsMode: IKCollisionsMode = OtherMechanismsAnchored) to (part: BasePart, target: CFrame, translateStiffness: float = 0.5, rotateStiffness: float = 0.5, collisionsMode: IKCollisionsMode = OtherMechanismsAnchored)
- 470 Add GetPartsInPart
- 470 Add GetPartBoundsInRadius
- 470 Add GetPartBoundsInBox
- 462 Change ThreadSafety of findPartsInRegion3 from to Unsafe
- 462 Change ThreadSafety of findPartOnRay from to Unsafe
- 462 Change ThreadSafety of SetInsertPoint from to Unsafe
- 462 Change ThreadSafety of Raycast from to ReadOnly
- 462 Change ThreadSafety of IsRegion3EmptyWithIgnoreList from to Unsafe
- 462 Change ThreadSafety of IsRegion3Empty from to Unsafe
- 462 Change ThreadSafety of IKMoveTo from to Unsafe
- 462 Change ThreadSafety of FindPartsInRegion3WithWhiteList from to Unsafe
- 462 Change ThreadSafety of FindPartsInRegion3WithIgnoreList from to Unsafe
- 462 Change ThreadSafety of FindPartsInRegion3 from to ReadOnly
- 462 Change ThreadSafety of FindPartOnRayWithWhitelist from to Unsafe
- 462 Change ThreadSafety of FindPartOnRayWithIgnoreList from to Unsafe
- 462 Change ThreadSafety of FindPartOnRay from to Unsafe
- 462 Change ThreadSafety of BulkMoveTo from to Unsafe
- 462 Change ThreadSafety of ArePartsTouchingOthers from to Unsafe
- 454 Change MemoryCategory of WorldRoot from Instances to PhysicsParts
- 452 Change MemoryCategory of WorldRoot from PhysicsParts to Instances
- 453 Change MemoryCategory of WorldRoot from Instances to PhysicsParts
- 442 Change Tags of FindPartOnRayWithWhitelist from [] to [Deprecated]
- 442 Change Tags of FindPartOnRayWithIgnoreList from [] to [Deprecated]
- 442 Change Tags of FindPartOnRay from [] to [Deprecated]
- 438 Change Parameters of Raycast from (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, FilterDescendantsInstances={}}) to (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 435 Add BulkMoveTo
- 434 Add ArePartsTouchingOthers
- 431 Add SetInsertPoint
- 429 Remove SetInsertPoint
- 430 Add SetInsertPoint
- 427 Remove IkMoveTo
- 427 Add IKMoveTo
- 422 Change ReturnType of Raycast from Tuple to RaycastResult
- 420 Add Raycast
- 419 Remove Raycast
- 420 Add Raycast
- 418 Add IkMoveTo
- 410 Add findPartsInRegion3
- 410 Add findPartOnRay
- 410 Add IsRegion3EmptyWithIgnoreList
- 410 Add IsRegion3Empty
- 410 Add FindPartsInRegion3WithWhiteList
- 410 Add FindPartsInRegion3WithIgnoreList
- 410 Add FindPartsInRegion3
- 410 Add FindPartOnRayWithWhitelist
- 410 Add FindPartOnRayWithIgnoreList
- 410 Add FindPartOnRay
- 410 Add WorldRoot
Members 25
ArePartsTouchingOthers
Parameters (2) | Default | |
---|---|---|
partList | Instances | |
overlapIgnored | float | 0.000199999995 |
Returns (1) | ||
bool |
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.
Thread safety | Unsafe |
---|
History 3
- 648 Change Parameters of ArePartsTouchingOthers from (partList: Objects, overlapIgnored: float = 0.000199999995) to (partList: Instances, overlapIgnored: float = 0.000199999995)
- 462 Change ThreadSafety of ArePartsTouchingOthers from to Unsafe
- 434 Add ArePartsTouchingOthers
Blockcast
Parameters (4) | Default | |
---|---|---|
cframe | CFrame | |
size | Vector3 | |
direction | Vector3 | |
params | RaycastParams | RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
RaycastResult? |
Casts a block shape in a given direction and returns the first collision with a BasePart or Terrain cell. This is analogous to how WorldRoot:Raycast() casts a linear ray in a direction to find a collision, but it uses a 3D shape instead of a ray.
Unlike WorldRoot:GetPartsInPart(), this method does not detect BaseParts that initially intersect the shape.
If a hit is detected, a RaycastResult is returned containing the hit information. The Distance property represents the distance the shape has to travel to find a hit, and the Position property represents the intersection point that causes the hit.
This method throws an error if it is passed invalid CFrame, size, or direction inputs.
Thread safety | Safe |
---|
History 3
- 638 Change ReturnType of Blockcast from RaycastResult to RaycastResult?
- 572 Change ThreadSafety of Blockcast from Unsafe to Safe
- 569 Add Blockcast
BulkMoveTo
Parameters (3) | Default | |
---|---|---|
partList | Instances | |
cframeList | Array | |
eventMode | BulkMoveMode | FireAllEvents |
Returns (1) | ||
null |
This function moves a table of BaseParts to a table of CFrames without necessarily firing the default property Changed events. This provides a very fast way to move large numbers of parts, as you don't have to pay the cost of separate property sets for each individual part.
The third argument allows you to further optimize the movement operation. By default, the Changed event of each part fires for Position, Orientation, and CFrame. However, if you specify FireCFrameChanged as the third argument, only the Changed event for the CFrame property will fire.
Note that you should only use this function if you're sure that part movement is a bottleneck in your code. Simply setting the CFrame property of individual parts and welded models is fast enough in the majority of cases.
Thread safety | Unsafe |
---|
History 4
- 648 Change Parameters of BulkMoveTo from (partList: Objects, cframeList: Array, eventMode: BulkMoveMode = FireAllEvents) to (partList: Instances, cframeList: Array, eventMode: BulkMoveMode = FireAllEvents)
- 573 Change ReturnType of BulkMoveTo from void to null
- 462 Change ThreadSafety of BulkMoveTo from to Unsafe
- 435 Add BulkMoveTo
CacheCurrentTerrain
Parameters (3) | ||
---|---|---|
id | string | |
center | Vector3 | |
radius | float | |
Returns (1) | ||
string |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
ClearCachedTerrain
Parameters (1) | ||
---|---|---|
id | string | |
Returns (1) | ||
bool |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
FindPartOnRay
Parameters (4) | Default | |
---|---|---|
ray | Ray | |
ignoreDescendantsInstance | Instance | Instance |
terrainCellsAreCubes | bool | false |
ignoreWater | bool | false |
Returns (1) | ||
Tuple |
FindPartOnRay uses raycasting to find the first BasePart or Terrain cell intersecting with a given Ray. This function returns the BasePart or terrain cell hit, the point of intersection, the surface normal at the point of intersection, and the associated Material hit.
If the ignoreDescendantsInstance
parameter is provided, the raycasting
calculation will ignore the given object and all of its descendants. It
behaves similar to the Mouse.TargetFilter property.
The terrainCellsAreCubes
and ignoreWater
parameters determine whether
Terrain cells should be treated as cubes or not, and whether water
should be ignored or not.
In order to include or exclude multiple objects and their descendants, use the WorldRoot:FindPartOnRayWithWhitelist() and WorldRoot:FindPartOnRayWithIgnoreList() variants.
Notes
- Theoretically, a ray extends infinitely in one direction. However, the max length of the direction vector on Roblox is 15000 studs.
- The length (magnitude) of the directional vector is important, as parts further away than its length will not be tested.
- If the ray does not intersect anything, the return values will be
nil
and the point at the end of the ray, respectively. - Parts that are in a collision group that does not collide with the "Default" collision group are ignored implicitly.
Thread safety | Unsafe |
---|
History 4
- 553 Change PreferredDescriptor of FindPartOnRay from to Raycast
- 462 Change ThreadSafety of FindPartOnRay from to Unsafe
- 442 Change Tags of FindPartOnRay from [] to [Deprecated]
- 410 Add FindPartOnRay
FindPartOnRayWithIgnoreList
Parameters (4) | Default | |
---|---|---|
ray | Ray | |
ignoreDescendantsTable | Instances | |
terrainCellsAreCubes | bool | false |
ignoreWater | bool | false |
Returns (1) | ||
Tuple |
This function is a variant of WorldRoot:FindPartOnRay() with the addition of an ignore list. This lets you ignore certain parts or Models.
Those looking to include a specific group of objects should instead use WorldRoot:FindPartOnRayWithWhitelist().
Thread safety | Unsafe |
---|
History 5
- 648 Change Parameters of FindPartOnRayWithIgnoreList from (ray: Ray, ignoreDescendantsTable: Objects, terrainCellsAreCubes: bool = false, ignoreWater: bool = false) to (ray: Ray, ignoreDescendantsTable: Instances, terrainCellsAreCubes: bool = false, ignoreWater: bool = false)
- 553 Change PreferredDescriptor of FindPartOnRayWithIgnoreList from to Raycast
- 462 Change ThreadSafety of FindPartOnRayWithIgnoreList from to Unsafe
- 442 Change Tags of FindPartOnRayWithIgnoreList from [] to [Deprecated]
- 410 Add FindPartOnRayWithIgnoreList
FindPartOnRayWithWhitelist
Parameters (3) | Default | |
---|---|---|
ray | Ray | |
whitelistDescendantsTable | Instances | |
ignoreWater | bool | false |
Returns (1) | ||
Tuple |
This function is a variant of WorldRoot:FindPartOnRay() with the addition of an inclusion list. This lets you detect only certain parts or Models and is particularly useful when, for example, looking for points of intersection between a ray and a single part.
If a nil
value is given in the inclusion list, instances after it will
be disregarded.
Those looking to exclude a specific group of objects should instead use WorldRoot:FindPartOnRayWithIgnoreList().
Thread safety | Unsafe |
---|
History 5
- 648 Change Parameters of FindPartOnRayWithWhitelist from (ray: Ray, whitelistDescendantsTable: Objects, ignoreWater: bool = false) to (ray: Ray, whitelistDescendantsTable: Instances, ignoreWater: bool = false)
- 553 Change PreferredDescriptor of FindPartOnRayWithWhitelist from to Raycast
- 462 Change ThreadSafety of FindPartOnRayWithWhitelist from to Unsafe
- 442 Change Tags of FindPartOnRayWithWhitelist from [] to [Deprecated]
- 410 Add FindPartOnRayWithWhitelist
FindPartsInRegion3
Parameters (3) | Default | |
---|---|---|
region | Region3 | |
ignoreDescendantsInstance | Instance | Instance |
maxParts | int | 20 |
Returns (1) | ||
Instances |
Returns an array of BaseParts in the given Region3.
This function takes an optional maxParts parameter (default 20) which limits the number of BaseParts that can be returned. Once this number has been reached, the search for BaseParts will stop. This means some BaseParts may not be returned even if they are within the Region3
The optional ignoreDescendantsInstance
parameter can be used to specify
a specific instance for whom itself and all of its descendants should be
ignored by this function. This can be useful when, for example, looking to
see if any BaseParts are inside a BasePart other
than the BasePart itself.
local min = part.Position - (0.5 * part.Size)
local max = part.Position + (0.5 * part.Size)
local region = Region3.new(min, max)
local parts = worldroot:FindPartsInRegion3(region, part) -- Ignore part
The WorldRoot:FindPartsInRegion3WithIgnoreList() and WorldRoot:FindPartsInRegion3WithWhiteList() variants of this method exist to provide specific exclusion and inclusion functionality.
If no BaseParts are found, an empty array will be returned.
Thread safety | Unsafe |
---|
History 7
- 648 Change ReturnType of FindPartsInRegion3 from Objects to Instances
- 553 Change PreferredDescriptor of FindPartsInRegion3 from to GetPartBoundsInBox
- 512 Change ThreadSafety of FindPartsInRegion3 from Safe to Unsafe
- 512 Change Tags of FindPartsInRegion3 from [] to [Deprecated]
- 486 Change ThreadSafety of FindPartsInRegion3 from ReadOnly to Safe
- 462 Change ThreadSafety of FindPartsInRegion3 from to ReadOnly
- 410 Add FindPartsInRegion3
FindPartsInRegion3WithIgnoreList
Parameters (3) | Default | |
---|---|---|
region | Region3 | |
ignoreDescendantsTable | Instances | |
maxParts | int | 20 |
Returns (1) | ||
Instances |
Returns an array of BaseParts in the given Region3 that aren't in, or a descendant of an entry in, the given ignore list.
If a nil
value is given in the ignore list, instances after this value
will not be ignored. If no BaseParts are found, an empty
array will be returned.
This function is a variant of WorldRoot:FindPartsInRegion3() with the addition of an ignore list. This allows the developer to exclude certain BaseParts or Models from the search. Those looking to find BaseParts in a Region3 using an inclusion list should use WorldRoot:FindPartsInRegion3WithWhiteList().
Thread safety | Unsafe |
---|
History 6
- 648 Change Parameters of FindPartsInRegion3WithIgnoreList from (region: Region3, ignoreDescendantsTable: Objects, maxParts: int = 20) to (region: Region3, ignoreDescendantsTable: Instances, maxParts: int = 20)
- 648 Change ReturnType of FindPartsInRegion3WithIgnoreList from Objects to Instances
- 553 Change PreferredDescriptor of FindPartsInRegion3WithIgnoreList from to GetPartBoundsInBox
- 512 Change Tags of FindPartsInRegion3WithIgnoreList from [] to [Deprecated]
- 462 Change ThreadSafety of FindPartsInRegion3WithIgnoreList from to Unsafe
- 410 Add FindPartsInRegion3WithIgnoreList
FindPartsInRegion3WithWhiteList
Parameters (3) | Default | |
---|---|---|
region | Region3 | |
whitelistDescendantsTable | Instances | |
maxParts | int | 20 |
Returns (1) | ||
Instances |
Returns an array of BaseParts in the given Region3 that are in, or descendant of an entry in, the given inclusion list.
If a nil
value is given in the inclusion list, instances after this
value will not be ignored. If no BaseParts are found, an
empty array will be returned.
This function is a variant of WorldRoot:FindPartsInRegion3() with the addition of an inclusion list. This allows the developer to include only certain BaseParts or Models in the search. Those looking to find BaseParts in a Region3 using an exclusion list should use WorldRoot:FindPartsInRegion3WithIgnoreList().
Thread safety | Unsafe |
---|
History 6
- 648 Change Parameters of FindPartsInRegion3WithWhiteList from (region: Region3, whitelistDescendantsTable: Objects, maxParts: int = 20) to (region: Region3, whitelistDescendantsTable: Instances, maxParts: int = 20)
- 648 Change ReturnType of FindPartsInRegion3WithWhiteList from Objects to Instances
- 553 Change PreferredDescriptor of FindPartsInRegion3WithWhiteList from to GetPartBoundsInBox
- 512 Change Tags of FindPartsInRegion3WithWhiteList from [] to [Deprecated]
- 462 Change ThreadSafety of FindPartsInRegion3WithWhiteList from to Unsafe
- 410 Add FindPartsInRegion3WithWhiteList
GetPartBoundsInBox
Parameters (3) | Default | |
---|---|---|
cframe | CFrame | |
size | Vector3 | |
overlapParams | OverlapParams | OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
Instances |
WorldRoot:GetPartBoundsInBox() returns an array of parts whose bounding boxes overlap a box whose volume is described using the given center (CFrame) and size (Vector3).
As emphasized, this spatial query method efficiently considers the volume of parts' bounding boxes rather than their actual occupied volume. This may be important when considering cylinders, spheres, unions, and MeshParts which have non-block shapes. For cases where accuracy especially matters, use WorldRoot:GetPartsInPart() instead, or further filter the results of this method yourself.
This method uses a OverlapParams object to describe reusable portions of the spatial query, such as an inclusion or exclusion list, the maximum number of parts to query, what collision group to use, and whether the query favors an intersected part's BasePart.CanCollide value over its BasePart.CanQuery value.
Thread safety | Safe |
---|
History 6
- 648 Change ReturnType of GetPartBoundsInBox from Objects to Instances
- 640 Change Parameters of GetPartBoundsInBox from (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 549 Change Parameters of GetPartBoundsInBox from (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 512 Change ThreadSafety of GetPartBoundsInBox from Unsafe to Safe
- 509 Change Parameters of GetPartBoundsInBox from (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (cframe: CFrame, size: Vector3, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 470 Add GetPartBoundsInBox
GetPartBoundsInRadius
Parameters (3) | Default | |
---|---|---|
position | Vector3 | |
radius | float | |
overlapParams | OverlapParams | OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
Instances |
WorldRoot:GetPartBoundsInRadius() returns an array of parts whose bounding boxes overlap a sphere whose volume is described using the given center (Vector3) and radius (number).
As emphasized, this spatial query method efficiently considers the volume of parts' bounding boxes rather than their actual occupied volume. This may be important when considering cylinders, spheres, unions, and MeshParts which have non-block shapes. For cases where accuracy especially matters, use WorldRoot:GetPartsInPart() instead, or further filter the results of this method yourself.
This method uses a OverlapParams object to describe reusable portions of the spatial query, such as an inclusion or exclusion list, the maximum number of parts to query, what collision group to use, and whether the query favors an intersected part's BasePart.CanCollide value over its BasePart.CanQuery value.
Thread safety | Safe |
---|
History 6
- 648 Change ReturnType of GetPartBoundsInRadius from Objects to Instances
- 640 Change Parameters of GetPartBoundsInRadius from (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 549 Change Parameters of GetPartBoundsInRadius from (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 512 Change ThreadSafety of GetPartBoundsInRadius from Unsafe to Safe
- 509 Change Parameters of GetPartBoundsInRadius from (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (position: Vector3, radius: float, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 470 Add GetPartBoundsInRadius
GetPartsInPart
Parameters (2) | Default | |
---|---|---|
part | BasePart | |
overlapParams | OverlapParams | OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
Instances |
WorldRoot:GetPartsInPart() returns an array of parts whose occupied space is shared with the given part (which must exist in the same WorldRoot as the parts to be queried). This method can be used in place of BasePart:GetTouchingParts() and is generally a better choice.
As noted, this spatial query method considers the exact volume occupied by the given part using a full geometric collision check. As an example, a concave/hollow part won't match queried parts within it unless they actually overlap/touch such a part. For simpler volumes, consider using WorldRoot:GetPartBoundsInBox() or WorldRoot:GetPartBoundsInRadius(), as they are less accurate but perform more efficiently.
This method uses a OverlapParams object to describe reusable portions of the spatial query, such as an inclusion or exclusion list, the maximum number of parts to query, what collision group to use, and whether the query favors an intersected part's BasePart.CanCollide value over its BasePart.CanQuery value.
Thread safety | Safe |
---|
History 7
- 648 Change ReturnType of GetPartsInPart from Objects to Instances
- 640 Change Parameters of GetPartsInPart from (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=0, Tolerance=0, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 549 Change Parameters of GetPartsInPart from (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 512 Change ThreadSafety of GetPartsInPart from Unsafe to Safe
- 509 Change Parameters of GetPartsInPart from (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 492 Change Parameters of GetPartsInPart from (part: Instance, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (part: BasePart, overlapParams: OverlapParams = OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 470 Add GetPartsInPart
IKMoveTo
Parameters (5) | Default | |
---|---|---|
part | BasePart | |
target | CFrame | |
translateStiffness | float | 0.5 |
rotateStiffness | float | 0.5 |
collisionsMode | IKCollisionsMode | OtherMechanismsAnchored |
Returns (1) | ||
null |
This function moves the specified part to the specified location via inverse kinematics rather than moving it there directly, to ensure any joints, constraints, or collisions that part is participating in remain physically satisfied. Currently this function is only available in Studio to plugins, as it currently conflicts with the physics of a running game.
Translate stiffness is a number between 0 and 1 specifying how aggressively to match the part's position to the position part of the target CFrame. Rotate stiffness is a number between 0 and 1 specifying how aggressively to match the part's rotation to the rotation part of the target CFrame.
For example:
- If translate stiffness and rotate stiffness are both equal to 1, then the part will be moved exactly to the target CFrame regardless of what physical constraints there are on it.
- If translate stiffness and rotate stiffness are both equal to 0.5, then the part will try to move to exactly the target CFrame, but may be pushed out of the way by physical constraints on it.
- If translate stiffness and rotate stiffness are both equal to 0, then the target CFrame will be ignored and physical constraints will be solved for the object at the position where it was.
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
History 4
- 573 Change ReturnType of IKMoveTo from void to null
- 483 Change Parameters of IKMoveTo from (part: Instance, target: CFrame, translateStiffness: float = 0.5, rotateStiffness: float = 0.5, collisionsMode: IKCollisionsMode = OtherMechanismsAnchored) to (part: BasePart, target: CFrame, translateStiffness: float = 0.5, rotateStiffness: float = 0.5, collisionsMode: IKCollisionsMode = OtherMechanismsAnchored)
- 462 Change ThreadSafety of IKMoveTo from to Unsafe
- 427 Add IKMoveTo
IsRegion3Empty
Parameters (2) | Default | |
---|---|---|
region | Region3 | |
ignoreDescendentsInstance | Instance | Instance |
Returns (1) | ||
bool |
IsRegion3Empty returns a bool indicating whether there are no BaseParts within the given Region3.
The optional ignoreDescendantsInstance
parameter can be used to specify
a specific instance for whom itself and all of its descendants should be
ignored by this function. This can be useful when, for example, looking to
see if any BaseParts are inside a BasePart other
than the BasePart itself.
local min = part.Position - (0.5 * part.Size)
local max = part.Position + (0.5 * part.Size)
local region = Region3.new(min, max)
local isPartEmpty = worldroot:IsRegion3Empty(region, part) -- Ignore part
If more than one object and its descendants need to be excluded from the search, developers should use WorldRoot:IsRegion3EmptyWithIgnoreList().
This function only returns if a region is empty or not. Developers looking to find BaseParts in a region should use WorldRoot:FindPartsInRegion3().
How do Region3 checks work?
Checking if a part overlaps a Region3 is not a simple process. It actually is time consuming and complicated. Instead it checks if parts are roughly in the same area. When this function is called, it figures out which voxels contain the Region3. It then figures out which parts might be in those voxels. It does this by comparing the axis-aligned bounding box (sometimes called the AABB) of the part with the voxels. The axis-aligned bounding box can be seen in Roblox Studio when a part is selected.
This means that the area that is inspected by the function may be larger than the Region3. For this reason it is recommended to make sure that the Region3 is on the voxel grid. The best way to do this is by setting the coordinates of the Region3 to multiples of 4 (since voxels are 4 x 4 x 4 studs).
This method is a fairly quick and easy way to see if any parts are in a general area. If a game needs to know if parts are exactly in an area, then BasePart:GetTouchingParts() should be used. There is a higher cost to using BasePart:GetTouchingParts() since a part is needed in the WorldRoot and the function takes more time to run.
Thread safety | Unsafe |
---|
History 4
- 553 Change PreferredDescriptor of IsRegion3Empty from to GetPartBoundsInBox
- 512 Change Tags of IsRegion3Empty from [] to [Deprecated]
- 462 Change ThreadSafety of IsRegion3Empty from to Unsafe
- 410 Add IsRegion3Empty
IsRegion3EmptyWithIgnoreList
Parameters (2) | ||
---|---|---|
region | Region3 | |
ignoreDescendentsTable | Instances | |
Returns (1) | ||
bool |
Returns a boolean indicating whether there are no
BaseParts within the given Region3, ignoring
any BaseParts that are descendants of the objects within
the given ignore list. If a nil
value is given in the ignore list,
instances after this value will not be ignored.
This function only returns if a region is empty or not. Developers looking to find specific BaseParts in a region should use WorldRoot:FindPartsInRegion3WithIgnoreList().
This function is a variant of WorldRoot:IsRegion3Empty() with the addition of an ignore list. In cases where an inclusion list is required instead, developers should check to see if any parts are returned by WorldRoot:FindPartsinRegion3WithWhitelist().
Thread safety | Unsafe |
---|
History 5
- 648 Change Parameters of IsRegion3EmptyWithIgnoreList from (region: Region3, ignoreDescendentsTable: Objects) to (region: Region3, ignoreDescendentsTable: Instances)
- 553 Change PreferredDescriptor of IsRegion3EmptyWithIgnoreList from to GetPartBoundsInBox
- 512 Change Tags of IsRegion3EmptyWithIgnoreList from [] to [Deprecated]
- 462 Change ThreadSafety of IsRegion3EmptyWithIgnoreList from to Unsafe
- 410 Add IsRegion3EmptyWithIgnoreList
Raycast
Parameters (3) | Default | |
---|---|---|
origin | Vector3 | |
direction | Vector3 | |
raycastParams | RaycastParams | RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
RaycastResult? |
Casts a ray using an origin, direction, and optional RaycastParams. If it finds an eligible BasePart or Terrain cell, a RaycastResult is returned containing the results of the operation. If no RaycastParams object is provided, the defaults are used (all parts are considered and Terrain water is not ignored).
Note that the length (magnitude) of the directional vector is important, as objects/terrain further away than its length will not be tested. If you're using a CFrame to help create the ray components, consider using CFrame.LookVector as the directional vector and multiply it by the desired length as shown in the example below. The maximum length of the direction vector is 15,000 studs.
This method does not use a Ray object, but its origin and direction components can be borrowed from Ray.Origin and Ray.Direction.
Thread safety | Safe |
---|
History 10
- 638 Change ReturnType of Raycast from RaycastResult to RaycastResult?
- 549 Change Parameters of Raycast from (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 509 Change Parameters of Raycast from (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, CollisionGroup=Default, FilterDescendantsInstances={}}) to (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 486 Change ThreadSafety of Raycast from ReadOnly to Safe
- 462 Change ThreadSafety of Raycast from to ReadOnly
- 438 Change Parameters of Raycast from (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, FilterDescendantsInstances={}}) to (origin: Vector3, direction: Vector3, raycastParams: RaycastParams = RaycastParams{IgnoreWater=false, CollisionGroup=Default, FilterDescendantsInstances={}})
- 422 Change ReturnType of Raycast from Tuple to RaycastResult
- 420 Add Raycast
- 419 Remove Raycast
- 420 Add Raycast
RaycastCachedTerrain
Parameters (4) | ||
---|---|---|
id | string | |
origin | Vector3 | |
direction | Vector3 | |
ignoreWater | bool | |
Returns (1) | ||
RaycastResult? |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 638 Change ReturnType of RaycastCachedTerrain from RaycastResult to RaycastResult?
- 552 Add RaycastCachedTerrain
SetInsertPoint
Parameters (2) | Default | |
---|---|---|
point | Vector3 | |
ignoreGrid | bool | false |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 5
- 573 Change ReturnType of SetInsertPoint from void to null
- 462 Change ThreadSafety of SetInsertPoint from to Unsafe
- 431 Add SetInsertPoint
- 429 Remove SetInsertPoint
- 430 Add SetInsertPoint
Shapecast
Parameters (3) | Default | |
---|---|---|
part | BasePart | |
direction | Vector3 | |
params | RaycastParams | RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
RaycastResult? |
Thread safety | Unsafe |
---|
History 2
- 638 Change ReturnType of Shapecast from RaycastResult to RaycastResult?
- 603 Add Shapecast
Spherecast
Parameters (4) | Default | |
---|---|---|
position | Vector3 | |
radius | float | |
direction | Vector3 | |
params | RaycastParams | RaycastParams{IgnoreWater=false, BruteForceAllSlow=false, RespectCanCollide=false, CollisionGroup=Default, FilterDescendantsInstances={}} |
Returns (1) | ||
RaycastResult? |
Casts a spherical shape in a given direction and returns the first collision with a BasePart or Terrain cell. This is analogous to how WorldRoot:Raycast() casts a linear ray in a direction to find a collision, but it uses a 3D shape instead of a ray.
Unlike WorldRoot:GetPartsInPart(), this method does not detect BaseParts that initially intersect the shape.
If a hit is detected, a RaycastResult is returned containing the hit information. The Distance property represents the distance the shape has to travel to find a hit, and the Position property represents the intersection point that causes the hit.
This method throws an error if it is passed invalid radius or direction inputs.
Thread safety | Safe |
---|
History 3
- 638 Change ReturnType of Spherecast from RaycastResult to RaycastResult?
- 572 Change ThreadSafety of Spherecast from Unsafe to Safe
- 569 Add Spherecast
StepPhysics
Parameters (2) | Default | |
---|---|---|
dt | float | |
parts | Instances | {} |
Returns (1) | ||
null |
Advances the simulation for parts in the world forward based on a specified time increment and an optional set of BasePart. When a set of parts is specified, only these parts will be simulated and all other parts in the world will be treated as anchored. When this argument is left out, all parts in the world will be included in the simulation. The specified time increment can be any positive number, with larger values increasing the runtime of the function. Depending on the value of the time increment, the physics system may subdivide it into multiple individual steps to maintain the accuracy and stability of the simulation. Even if the function performs multiple substeps, the results of the simulation will only be seen once the function completes. To visualize the individual steps of a simulation, the function can be called once per RenderStep via the RunService.RenderStepped event.
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 648 Change Parameters of StepPhysics from (dt: float, parts: Objects = {}) to (dt: float, parts: Instances = {})
- 616 Add StepPhysics
findPartOnRay
Parameters (4) | Default | |
---|---|---|
ray | Ray | |
ignoreDescendantsInstance | Instance | Instance |
terrainCellsAreCubes | bool | false |
ignoreWater | bool | false |
Returns (1) | ||
Tuple |
Thread safety | Unsafe |
---|
History 3
- 553 Change PreferredDescriptor of findPartOnRay from to Raycast
- 462 Change ThreadSafety of findPartOnRay from to Unsafe
- 410 Add findPartOnRay
findPartsInRegion3
Parameters (3) | Default | |
---|---|---|
region | Region3 | |
ignoreDescendantsInstance | Instance | Instance |
maxParts | int | 20 |
Returns (1) | ||
Instances |
Thread safety | Unsafe |
---|
History 4
- 648 Change ReturnType of findPartsInRegion3 from Objects to Instances
- 553 Change PreferredDescriptor of findPartsInRegion3 from to GetPartBoundsInBox
- 462 Change ThreadSafety of findPartsInRegion3 from to Unsafe
- 410 Add findPartsInRegion3