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

C#: Add IntersectsRay to Aabb #97695

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Synthetic-Dev
Copy link

@Synthetic-Dev Synthetic-Dev commented Oct 1, 2024

  • Add IntersectsRay
    • Use intersects_ray implementation without inside/normal/intersection point calculation

@Synthetic-Dev Synthetic-Dev requested a review from a team as a code owner October 1, 2024 15:10
@Chaosus Chaosus added this to the 4.x milestone Oct 4, 2024
@Synthetic-Dev Synthetic-Dev changed the title [WIP] C#: Sync GodotSharp Aabb with Core C#: Add IntersectsRay to Aabb Nov 2, 2024
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.

Thanks for contributing to the .NET module! Looks like the code matches the Core implementation, and is consistent with the other Intersects* methods in Aabb. I'm making a few comments, mostly about code-style.

Also, since you are a new contributor, make sure to read CONTRIBUTING.md and the contributing documentation if you haven't already.

You'll need to squash the commits before this PR can be merged. The contributing documentation contains information about squashing in case you need it.

Feel free to reach out in the development chat if you need help.

modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs Outdated Show resolved Hide resolved
/// </returns>
public readonly bool IntersectsRay(Vector3 from, Vector3 dir)
{
if (HasPoint(from)) return true;
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this in the Core implementation, and seems a bit redundant.

Suggested change
if (HasPoint(from)) return true;
if (HasPoint(from))
{
return true;
}

Copy link
Author

Choose a reason for hiding this comment

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

You're saying remove it? Seems like a potential optimisation to me but I may be wrong

Copy link
Member

Choose a reason for hiding this comment

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

We'd have to benchmark it to see if makes a difference.

modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs Outdated Show resolved Hide resolved
modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs Outdated Show resolved Hide resolved
@raulsntos raulsntos modified the milestones: 4.x, 4.4 Nov 2, 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.

3 participants