Skip to content

Physics

The Physics class is a static class that is primarily used for handling physics-related operations such as collision detection, rigid body movement, ray casting, and more.

静态变量

Physics.isQueriesHitTriggers : boolean
(Read Only) Specifies whether queries (raycasts, spherecasts, overlap tests, etc.) hit triggers by default.
Physics.isQueriesHitBackfaces : boolean
(Read Only) Whether the physics query should hit back-facing triangles.

静态方法

Physics.Raycast ( ray : Ray , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined
Performs a raycast.
Physics.CapsuleCastAll ( p0 : Vector3 , p1 : Vector3 , radius : number , direction : Vector3 , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined []
Performs a capsule cast and returns all the hit objects that intersect with it.
Physics.RaycastAll ( ray : Ray , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined []
Performs a raycast and returns all the hit objects.
Physics.SphereCast ( ray : Ray , radius : number , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined
Performs a spherecast in the scene to detect intersections between a sphere and objects. Stores information about the first object intersected.
Physics.SphereCastAll ( ray : Ray , radius : number , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined []
Performs a spherecast and returns all the hit objects.
Physics.CapsuleCast ( p0 : Vector3 , p1 : Vector3 , radius : number , direction : Vector3 , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined
Perform a capsule cast in the scene.
Physics.BoxCast ( center : Vector3 , extents : Vector3 , rotation : Quaternion , direction : Vector3 , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined
Performs a boxcast in the scene.
Physics.BoxCastAll ( center : Vector3 , extents : Vector3 , rotation : Quaternion , direction : Vector3 , maxDistance : number , mask : number , cast_trigger : QueryTriggerInteraction? ) : RaycastHit|undefined []
Performs a boxcast and returns all the hit objects.