PhysicsDirectSpaceState3D
Provides direct access to a physics space in the PhysicsServer3D
.
class PhysicsDirectSpaceState3D
Provides direct access to a physics space in the PhysicsServer3D
. It’s used mainly to do queries against objects and areas residing in a given space.
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
struct IntersectRayResult<T>
Result from intersecting a ray
Type members
Instance members
func castMotion(parameters: PhysicsShapeQueryParameters3D?
) -> PackedFloat32Array Checks how far a
Shape3D
can move without colliding. All the parameters for the query, including the shape, are supplied through aPhysicsShapeQueryParameters3D
object.func collideShape(parameters: PhysicsShapeQueryParameters3D?, maxResults: Int32
) -> VariantCollection<Vector3> Checks the intersections of a shape, given through a
PhysicsShapeQueryParameters3D
object, against the space. The resulting array contains a list of points where the shape intersects another. Like withintersectShape(parameters:maxResults:)
, the number of returned results can be limited to save processing time.func getRestInfo(parameters: PhysicsShapeQueryParameters3D?
) -> GDictionary Checks the intersections of a shape, given through a
PhysicsShapeQueryParameters3D
object, against the space. If it collides with more than one shape, the nearest one is selected. The returned object is a dictionary containing the following fields:func intersectPoint(parameters: PhysicsPointQueryParameters3D?, maxResults: Int32
) -> VariantCollection<GDictionary> Checks whether a point is inside any solid shape. Position and other parameters are defined through
PhysicsPointQueryParameters3D
. The shapes the point is inside of are returned in an array containing dictionaries with the following fields:func intersectRay<T>(T.Type, parameters: PhysicsRayQueryParameters3D
) -> IntersectRayResult<T>? Intersects a ray in a given space. Ray position and other parameters are defined through
PhysicsRayQueryParameters3D
The return value is anIntersectRayResult<T>?
whereT
is any GodotObject
, however if the ray did not intersect anything, or the intersecting collider was not of typeT
then a nil object is returned instead. UsuallyT
is a physics object such asStaticBody
for example but it could also be aGridMap
if themesh_library
has collisions.func intersectRay(parameters: PhysicsRayQueryParameters3D?
) -> GDictionary Intersects a ray in a given space. Ray position and other parameters are defined through
PhysicsRayQueryParameters3D
. The returned object is a dictionary with the following fields:func intersectShape(parameters: PhysicsShapeQueryParameters3D?, maxResults: Int32
) -> VariantCollection<GDictionary> Checks the intersections of a shape, given through a
PhysicsShapeQueryParameters3D
object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields:
Subclasses
class PhysicsDirectSpaceState3DExtension
Provides virtual methods that can be overridden to create custom
PhysicsDirectSpaceState3D
implementations.