From c3ae7ddedd8526fff273237cb61ebb866a723af5 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 10 Nov 2021 15:57:11 -0700 Subject: Add raycast options to hit when starting inside / hit back faces Makes the results consistent for all shape types with options to set the desired behavior. --- doc/classes/PhysicsDirectSpaceState2D.xml | 2 +- doc/classes/PhysicsDirectSpaceState3D.xml | 2 +- doc/classes/PhysicsRayQueryParameters2D.xml | 3 +++ doc/classes/PhysicsRayQueryParameters3D.xml | 6 ++++++ doc/classes/RayCast2D.xml | 5 ++++- doc/classes/RayCast3D.xml | 5 ++++- 6 files changed, 19 insertions(+), 4 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/PhysicsDirectSpaceState2D.xml b/doc/classes/PhysicsDirectSpaceState2D.xml index 5892ef266f..107d276df2 100644 --- a/doc/classes/PhysicsDirectSpaceState2D.xml +++ b/doc/classes/PhysicsDirectSpaceState2D.xml @@ -64,7 +64,7 @@ Intersects a ray in a given space. Ray position and other parameters are defined through [PhysicsRayQueryParameters2D]. 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]normal[/code]: The object's surface normal at the intersection point, or [code]Vector2(0, 0)[/code] if the ray starts inside the shape and [member PhysicsRayQueryParameters2D.hit_from_inside] is [code]true[/code]. [code]position[/code]: The intersection point. [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. diff --git a/doc/classes/PhysicsDirectSpaceState3D.xml b/doc/classes/PhysicsDirectSpaceState3D.xml index 6a7fe46518..349ce31ab4 100644 --- a/doc/classes/PhysicsDirectSpaceState3D.xml +++ b/doc/classes/PhysicsDirectSpaceState3D.xml @@ -65,7 +65,7 @@ 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: [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]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]. [code]position[/code]: The intersection point. [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. diff --git a/doc/classes/PhysicsRayQueryParameters2D.xml b/doc/classes/PhysicsRayQueryParameters2D.xml index 0e99e47286..b71b48f223 100644 --- a/doc/classes/PhysicsRayQueryParameters2D.xml +++ b/doc/classes/PhysicsRayQueryParameters2D.xml @@ -24,6 +24,9 @@ The starting point of the ray being queried for, in global coordinates. + + If [code]true[/code], the query will detect a hit when starting inside shapes. In this case the collision normal will be [code]Vector2(0, 0)[/code]. Does not affect concave polygon shapes. + The ending point of the ray being queried for, in global coordinates. diff --git a/doc/classes/PhysicsRayQueryParameters3D.xml b/doc/classes/PhysicsRayQueryParameters3D.xml index dbd09e5128..3085ff3b35 100644 --- a/doc/classes/PhysicsRayQueryParameters3D.xml +++ b/doc/classes/PhysicsRayQueryParameters3D.xml @@ -24,6 +24,12 @@ The starting point of the ray being queried for, in global coordinates. + + If [code]true[/code], the query will hit back faces with concave polygon shapes with back face enabled or heightmap shapes. + + + If [code]true[/code], the query will detect a hit when starting inside shapes. In this case the collision normal will be [code]Vector3(0, 0, 0)[/code]. Does not affect concave polygon shapes or heightmap shapes. + The ending point of the ray being queried for, in global coordinates. diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml index 592c074a77..d7540ef206 100644 --- a/doc/classes/RayCast2D.xml +++ b/doc/classes/RayCast2D.xml @@ -63,7 +63,7 @@ - Returns the normal of the intersecting object's shape at the collision point. + Returns the normal of the intersecting object's shape at the collision point, or [code]Vector2(0, 0)[/code] if the ray starts inside the shape and [member hit_from_inside] is [code]true[/code]. @@ -118,6 +118,9 @@ If [code]true[/code], the parent node will be excluded from collision detection. + + If [code]true[/code], the ray will detect a hit when starting inside shapes. In this case the collision normal will be [code]Vector2(0, 0)[/code]. Does not affect concave polygon shapes. + The ray's destination point, relative to the RayCast's [code]position[/code]. diff --git a/doc/classes/RayCast3D.xml b/doc/classes/RayCast3D.xml index c7253e81c4..f15643c93f 100644 --- a/doc/classes/RayCast3D.xml +++ b/doc/classes/RayCast3D.xml @@ -65,7 +65,7 @@ - Returns the normal of the intersecting object's shape at the collision point. + Returns the normal of the intersecting object's shape at the collision point, or [code]Vector3(0, 0, 0)[/code] if the ray starts inside the shape and [member hit_from_inside] is [code]true[/code]. @@ -127,6 +127,9 @@ If [code]true[/code], collisions will be ignored for this RayCast3D's immediate parent. + + If [code]true[/code], the ray will detect a hit when starting inside shapes. In this case the collision normal will be [code]Vector3(0, 0, 0)[/code]. Does not affect shapes with no volume like concave polygon or heightmap. + The ray's destination point, relative to the RayCast's [code]position[/code]. -- cgit v1.2.3