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

Fix selection in 3D Game view #101368

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

Hilderin
Copy link
Contributor

@Hilderin Hilderin commented Jan 9, 2025

This PR should fix the issue for the selection in 3D. I was no able to reproduce the issue in 2D.

The problem was the calculation of the distance between the raycast collision point and the camera position. Since the camera position and the raycast hit point are in global space, we don't need to apply any other transformation to calculate the distance between them.

In addition, the selection did not work on CSG if collision is not enabled. I added support for CSGShape without collision.

Exemple:

godot.windows.editor.dev.x86_64_jlsUhJGWuj.mp4

There's a little MRP project to test:
test-godot-select-game-workspace.zip

@Hilderin Hilderin requested a review from a team as a code owner January 9, 2025 20:50
@Hilderin Hilderin added the bug label Jan 9, 2025
@Hilderin Hilderin added this to the 4.4 milestone Jan 9, 2025
@Hilderin
Copy link
Contributor Author

Hilderin commented Jan 9, 2025

CC @YeldhamDev

Copy link
Member

@YeldhamDev YeldhamDev left a comment

Choose a reason for hiding this comment

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

LGTM.

@akien-mga akien-mga changed the title Fix Selection Game View Fix selection in 3D Game View Jan 9, 2025
@akien-mga akien-mga changed the title Fix selection in 3D Game View Fix selection in 3D Game view Jan 9, 2025
@Hilderin Hilderin force-pushed the fix-selection-game-view branch from 1d746c4 to 23c172c Compare January 9, 2025 23:22
@Hilderin Hilderin requested a review from a team as a code owner January 9, 2025 23:22
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

That looks much cleaner architecture wise!

@Hilderin Hilderin force-pushed the fix-selection-game-view branch from 23c172c to eaee346 Compare January 9, 2025 23:44
@Hilderin Hilderin force-pushed the fix-selection-game-view branch from eaee346 to 055b418 Compare January 10, 2025 14:53
@akien-mga akien-mga merged commit 4caae29 into godotengine:master Jan 10, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

Selection in Game view stops working correctly when using in-game camera override feature
5 participants