RUSTICDOCSSearch documentation

Physics queries

Find primitive colliders with raycasts, sphere casts and overlaps.

Feature status and language/platform compatibility

Choose an API to see its signature, parameters, examples and behavior.

APIs

Module guide

Setup and language support

These engine-owned services work in Lua 5.4, Luau, JavaScript, Python, C, C++, C#, Java, PHP, and HTML inline JavaScript. Follow Use gameplay actions to create and attach a script, install external toolchains, and choose the correct language binding. PHP and HTML scripts belong under ui/; CSS alone runs no gameplay code.

The Calls section uses JavaScript signatures. The function examples below include native syntax for all ten script types, including SDK-specific alternatives and limitations. Attach a JavaScript Object Component script to the specified target and press Play. Globals are supplied by the engine. Schedule actions from Start or a callback, rather than at script top level. Native languages use typed options and their own builder conventions; see the guide's language bindings.

Parameters

Origins and centers are finite three-component world vectors. Direction must be nonzero and is normalized by the engine. Ignore is an optional array of entity IDs in JavaScript; native query signatures differ.

Return and timing

Raycast/sphereCast immediately return the nearest {entity, point, normal, distance} or null; overlap returns entity IDs.

Behavior and limitations

  • Attach to a Part above an anchored collidable floor. The query reports the nearest hit.

  • Queries use primitive world AABBs including parent transforms. SphereCast uses rounded sphere/box contacts; model meshes do not automatically acquire primitive colliders.

  • See Basic physics for collider setup, gravity and collision limits.

  • Check script attachment, enabled state and the Console when an operation fails.