-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify expected types in RayCast3D
documentation
#101373
base: master
Are you sure you want to change the base?
Conversation
RayCast3D
documentation
@@ -44,7 +44,7 @@ | |||
<method name="get_collider" qualifiers="const"> | |||
<return type="Object" /> | |||
<description> | |||
Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). | |||
Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). This object is not guaranteed to be a [CollisionObject3D]. For example, if the ray intersects a [CSGShape3D] or a [GridMap], the method will return a [CSGShape3D] instance or [GridMap] instance. To validate and ensure type safety, you should explicitly check the type of the returned object before casting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). This object is not guaranteed to be a [CollisionObject3D]. For example, if the ray intersects a [CSGShape3D] or a [GridMap], the method will return a [CSGShape3D] instance or [GridMap] instance. To validate and ensure type safety, you should explicitly check the type of the returned object before casting. | |
Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). | |
[b]Note:[/b] This object is not guaranteed to be a [CollisionObject3D]. For example, if the ray intersects a [CSGShape3D] or a [GridMap], the method will return a [CSGShape3D] or [GridMap] instance. |
Casting is a kind of type testing, also I don't think an explicit comment is needed, but if it is added it should be more brief
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<class name="RayCast3D" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | |||
<brief_description> | |||
A ray in 3D space, used to find the first [CollisionObject3D] it intersects. | |||
A ray in 3D space, used to find the first [Object] or [CollisionObject3D] it intersects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A ray in 3D space, used to find the first [Object] or [CollisionObject3D] it intersects. | |
A ray in 3D space, used to find the first object it intersects. |
Let's remove any reference to avoid confusion
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<class name="RayCast3D" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | |||
<brief_description> | |||
A ray in 3D space, used to find the first [CollisionObject3D] it intersects. | |||
A ray in 3D space, used to find the first [Object] or [CollisionObject3D] it intersects. | |||
</brief_description> | |||
<description> | |||
A raycast represents a ray from its origin to its [member target_position] that finds the closest [CollisionObject3D] along its path, if it intersects any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The long description needs to be updated as well
Updating documentation, per #100139 (comment)
rburing
on Dec 7, 2024
Member
Yes, the documentation is wrong (too narrow). In addition to CSG there's also GridMap. Fixes to the documentation are welcome.