Debian Codegraph @

doc/classes/PhysicsDirectSpaceState3D.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="PhysicsDirectSpaceState3D" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Provides direct access to a physics space in the [PhysicsServer3D].
5 </brief_description>
6 <description>
7 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.
8 [b]Note:[/b] This class is not meant to be instantiated directly. Use [member World3D.direct_space_state] to get the world's physics 3D space state.
9 </description>
10 <tutorials>
11 <link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
12 <link title="Ray-casting">$DOCS_URL/tutorials/physics/ray-casting.html</link>
13 </tutorials>
14 <methods>
15 <method name="cast_motion">
16 <return type="PackedFloat32Array" />
17 <param index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
18 <description>
19 Checks how far a [Shape3D] can move without colliding. All the parameters for the query, including the shape and the motion, are supplied through a [PhysicsShapeQueryParameters3D] object.
20 Returns an array with the safe and unsafe proportions (between 0 and 1) of the motion. The safe proportion is the maximum fraction of the motion that can be made without a collision. The unsafe proportion is the minimum fraction of the distance that must be moved for a collision. If no collision is detected a result of [code][1.0, 1.0][/code] will be returned.
21 [b]Note:[/b] Any [Shape3D]s that the shape is already colliding with e.g. inside of, will be ignored. Use [method collide_shape] to determine the [Shape3D]s that the shape is already colliding with.
22 </description>
23 </method>
24 <method name="collide_shape">
25 <return type="Vector3[]" />
26 <param index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
27 <param index="1" name="max_results" type="int" default="32" />
28 <description>
29 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 with [method intersect_shape], the number of returned results can be limited to save processing time.
30 Returned points are a list of pairs of contact points. For each pair the first one is in the shape passed in [PhysicsShapeQueryParameters3D] object, second one is in the collided shape from the physics space.
31 [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object.
32 </description>
33 </method>
34 <method name="get_rest_info">
35 <return type="Dictionary" />
36 <param index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
37 <description>
38 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:
39 [code]collider_id[/code]: The colliding object's ID.
40 [code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area3D], the result is [code](0, 0, 0)[/code].
41 [code]normal[/code]: The collision normal of the query shape at the intersection point, pointing away from the intersecting object.
42 [code]point[/code]: The intersection point.
43 [code]rid[/code]: The intersecting object's [RID].
44 [code]shape[/code]: The shape index of the colliding shape.
45 If the shape did not intersect anything, then an empty dictionary is returned instead.
46 [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object.
47 </description>
48 </method>
49 <method name="intersect_point">
50 <return type="Dictionary[]" />
51 <param index="0" name="parameters" type="PhysicsPointQueryParameters3D" />
52 <param index="1" name="max_results" type="int" default="32" />
53 <description>
54 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:
55 [code]collider[/code]: The colliding object.
56 [code]collider_id[/code]: The colliding object's ID.
57 [code]rid[/code]: The intersecting object's [RID].
58 [code]shape[/code]: The shape index of the colliding shape.
59 The number of intersections can be limited with the [param max_results] parameter, to reduce the processing time.
60 </description>
61 </method>
62 <method name="intersect_ray">
63 <return type="Dictionary" />
64 <param index="0" name="parameters" type="PhysicsRayQueryParameters3D" />
65 <description>
66 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:
67 [code]collider[/code]: The colliding object.
68 [code]collider_id[/code]: The colliding object's ID.
69 [code]normal[/code]: The object's surface normal at the intersection point, or [code]Vector3(0, 0, 0)[/code] if the ray starts inside the shape and [member PhysicsRayQueryParameters3D.hit_from_inside] is [code]true[/code].
70 [code]position[/code]: The intersection point.
71 [code]face_index[/code]: The face index at the intersection point.
72 [b]Note:[/b] Returns a valid number only if the intersected shape is a [ConcavePolygonShape3D]. Otherwise, [code]-1[/code] is returned.
73 [code]rid[/code]: The intersecting object's [RID].
74 [code]shape[/code]: The shape index of the colliding shape.
75 If the ray did not intersect anything, then an empty dictionary is returned instead.
76 </description>
77 </method>
78 <method name="intersect_shape">
79 <return type="Dictionary[]" />
80 <param index="0" name="parameters" type="PhysicsShapeQueryParameters3D" />
81 <param index="1" name="max_results" type="int" default="32" />
82 <description>
83 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:
84 [code]collider[/code]: The colliding object.
85 [code]collider_id[/code]: The colliding object's ID.
86 [code]rid[/code]: The intersecting object's [RID].
87 [code]shape[/code]: The shape index of the colliding shape.
88 The number of intersections can be limited with the [param max_results] parameter, to reduce the processing time.
89 [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object.
90 </description>
91 </method>
92 </methods>
93 </class>