2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-03-30 18:22:57 +02:00
<class name= "PhysicsDirectSpaceState3D" inherits= "Object" version= "4.0" >
2017-09-12 22:42:36 +02:00
<brief_description >
2020-03-30 18:22:57 +02:00
Direct access object to a space in the [PhysicsServer3D].
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2020-03-30 18:22:57 +02:00
Direct access object to a space in the [PhysicsServer3D]. It's used mainly to do queries against objects and areas residing in a given space.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
2020-08-05 14:43:40 +02:00
<link title= "Ray-casting" > https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
2017-09-12 22:42:36 +02:00
</tutorials>
<methods >
<method name= "cast_motion" >
<return type= "Array" >
</return>
2020-03-30 18:22:57 +02:00
<argument index= "0" name= "shape" type= "PhysicsShapeQueryParameters3D" >
2017-09-12 22:42:36 +02:00
</argument>
<argument index= "1" name= "motion" type= "Vector3" >
</argument>
<description >
2019-01-07 10:02:04 +01:00
Checks whether the shape can travel to a point. The method will return an array with two floats between 0 and 1, both representing a fraction of [code]motion[/code]. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be [code][1, 1][/code].
2020-03-28 13:33:24 +01:00
If the shape can not move, the returned array will be [code][0, 0][/code] under Bullet, and empty under GodotPhysics3D.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "collide_shape" >
<return type= "Array" >
</return>
2020-03-30 18:22:57 +02:00
<argument index= "0" name= "shape" type= "PhysicsShapeQueryParameters3D" >
2017-09-12 22:42:36 +02:00
</argument>
<argument index= "1" name= "max_results" type= "int" default= "32" >
</argument>
<description >
2020-03-30 18:22:57 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_rest_info" >
<return type= "Dictionary" >
</return>
2020-03-30 18:22:57 +02:00
<argument index= "0" name= "shape" type= "PhysicsShapeQueryParameters3D" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
2020-03-30 18:22:57 +02:00
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:
2017-12-26 21:14:22 +01:00
[code]collider_id[/code]: The colliding object's ID.
2020-03-30 18:22:57 +02:00
[code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area3D], the result is [code](0, 0, 0)[/code].
2017-12-26 21:14:22 +01:00
[code]normal[/code]: The object's surface normal at the intersection point.
[code]point[/code]: The intersection point.
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
2018-08-29 22:25:11 +02:00
If the shape did not intersect anything, then an empty dictionary is returned instead.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "intersect_ray" >
<return type= "Dictionary" >
</return>
<argument index= "0" name= "from" type= "Vector3" >
</argument>
<argument index= "1" name= "to" type= "Vector3" >
</argument>
<argument index= "2" name= "exclude" type= "Array" default= "[ ]" >
</argument>
2018-08-29 22:25:11 +02:00
<argument index= "3" name= "collision_mask" type= "int" default= "2147483647" >
</argument>
<argument index= "4" name= "collide_with_bodies" type= "bool" default= "true" >
</argument>
<argument index= "5" name= "collide_with_areas" type= "bool" default= "false" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
2017-12-26 21:14:22 +01:00
Intersects a ray in a given space. The returned object is a dictionary with the following fields:
[code]collider[/code]: The colliding object.
[code]collider_id[/code]: The colliding object's ID.
[code]normal[/code]: The object's surface normal at the intersection point.
[code]position[/code]: The intersection point.
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
2018-08-29 22:25:11 +02:00
If the ray did not intersect anything, then an empty dictionary is returned instead.
2020-03-30 18:22:57 +02:00
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody3D]s or [Area3D]s, respectively.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "intersect_shape" >
<return type= "Array" >
</return>
2020-03-30 18:22:57 +02:00
<argument index= "0" name= "shape" type= "PhysicsShapeQueryParameters3D" >
2017-09-12 22:42:36 +02:00
</argument>
<argument index= "1" name= "max_results" type= "int" default= "32" >
</argument>
<description >
2020-03-30 18:22:57 +02:00
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:
2017-12-26 21:14:22 +01:00
[code]collider[/code]: The colliding object.
[code]collider_id[/code]: The colliding object's ID.
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
2018-09-23 01:18:55 +02:00
The number of intersections can be limited with the [code]max_results[/code] parameter, to reduce the processing time.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
<constants >
</constants>
</class>