class_physics2ddirectspacestate - dragonsoulz/godot GitHub Wiki
Physics2DDirectSpaceState
####Inherits: Object ####Category: Core
Brief Description
Direct access object to a space in the Physics2DServer.
Member Functions
- Dictionary intersect_ray ( Vector2 from, Vector2 to, Array exclude=Array(), int layer_mask=2147483647, int type_mask=15 )
- Array intersect_shape ( Physics2DShapeQueryParameters shape, int max_results=32 )
- Array cast_motion ( Physics2DShapeQueryParameters shape )
- Array collide_shape ( Physics2DShapeQueryParameters shape, int max_results=32 )
- Dictionary get_rest_info ( Physics2DShapeQueryParameters shape )
Numeric Constants
- TYPE_MASK_STATIC_BODY = 1
- TYPE_MASK_KINEMATIC_BODY = 2
- TYPE_MASK_RIGID_BODY = 4
- TYPE_MASK_CHARACTER_BODY = 8
- TYPE_MASK_AREA = 16
- TYPE_MASK_COLLISION = 15
Description
Direct access object to a space in the Physics2DServer. It's used mainly to do queries against objects and areas residing in a given space.
Member Function Description
intersect_ray
- Dictionary intersect_ray ( Vector2 from, Vector2 to, Array exclude=Array(), int layer_mask=2147483647, int type_mask=15 )
Intersect a ray in a given space, the returned object is a dictionary with the following fields:
position: place where ray is stopped
normal: normal of the object at the point where the ray was stopped
shape: shape index of the object agaisnt which the ray was stopped
collider_: collider agaisnt which the ray was stopped
collider_id: collider id of the object agaisnt which the ray was stopped
collider: collider object agaisnt which the ray was stopped
rid: [RID](class_rid) of the object agaisnt which the ray was stopped
If the ray did not intersect anything, then null is returned instead of a [Dictionary](class_dictionary).
intersect_shape
- Array intersect_shape ( Physics2DShapeQueryParameters shape, int max_results=32 )
Intersect a given shape (RID or Shape2D) against the space, the intersected shapes are returned in a special result object.