Skip to content
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

Add instructions to get shape of RayCast2D/3D #83735

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

AThousandShips
Copy link
Member

@AThousandShips AThousandShips commented Oct 21, 2023

Adds details on how to get the intersected shape

@AThousandShips AThousandShips added enhancement documentation topic:physics cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Oct 21, 2023
@AThousandShips AThousandShips added this to the 4.2 milestone Oct 21, 2023
@AThousandShips AThousandShips requested a review from a team October 21, 2023 15:24
@AThousandShips AThousandShips requested a review from a team as a code owner October 21, 2023 15:24
@AThousandShips
Copy link
Member Author

For the 2D case I'm not sure if it can collide with TileMap, in that case there would have to be a note on that, but I'm unsure how it works for that, don't think it works for it

@AThousandShips AThousandShips marked this pull request as draft October 21, 2023 15:50
@AThousandShips
Copy link
Member Author

Realized it was not a direct connection, updating the instructions

@AThousandShips
Copy link
Member Author

I'm unsure what the functional difference between the shape_id and owner_id is in CollisionObject, so added a more detailed instruction, could go back to the original description if considered sufficient:

Use with [method CollisionObject2D.shape_owner_get_owner] on the result of [method get_collider] to get the shape that was intersected with.

var shape = target.shape_owner_get_owner(owner_id)
[/gdscript]
[csharp]
var target = GetCollider(); // A CollisionObject2D.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfamiliar with C# here so unsure if this needs a cast or something

@AThousandShips AThousandShips modified the milestones: 4.2, 4.3 Oct 26, 2023
@AThousandShips AThousandShips added cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release and removed topic:physics labels Oct 26, 2023
@AThousandShips AThousandShips changed the title Adds instructions to get shape of RayCast2D/3D Add instructions to get shape of RayCast2D/3D Jan 2, 2024
@mhilbrunner
Copy link
Member

LGTM (also not 100% sure about the C#, maybe @raulsntos wants to confirm)

doc/classes/RayCast2D.xml Outdated Show resolved Hide resolved
doc/classes/RayCast3D.xml Outdated Show resolved Hide resolved
@AThousandShips
Copy link
Member Author

Thank you @raulsntos! Will fix later today (my power is off at the moment so can't work lol)

@AThousandShips
Copy link
Member Author

Removed the TileMap node, partially due to recent changes in TileMap, but also because the code doesn't apply, it's specific to CollisionObject2D, so we can add some code later for those cases because they work very differently

Adds details on how to get the intersected shape
Copy link
Member

@raulsntos raulsntos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C# looks good to me. Thanks!

@akien-mga akien-mga merged commit 00d4c63 into godotengine:master Apr 8, 2024
16 checks passed
@AThousandShips AThousandShips deleted the ray_doc branch April 8, 2024 09:28
@akien-mga
Copy link
Member

Thanks!

@AThousandShips
Copy link
Member Author

Thank you!

@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.

@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Apr 8, 2024
@akien-mga
Copy link
Member

Cherry-picked for 4.1.4.

@akien-mga akien-mga removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raycast ignores RigidBody's children when colliding with bodies
6 participants