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

Added viewport independent raycast #3709

Merged
merged 2 commits into from
Feb 4, 2024
Merged

Conversation

luis605
Copy link
Contributor

@luis605 luis605 commented Jan 5, 2024

GetMouseRay did not allow the user to cast a ray from the camera to the world view while in a viewport or renderTexture. To improve raylib, I added GetMouseRayEx, which has new arguments (width and height), making it easier to cast a ray to a specific viewport.

@Elkantor
Copy link
Contributor

Elkantor commented Jan 23, 2024

GetMouseRay did not allow the user to cast a ray from the camera to the world view while in a viewport or renderTexture. To improve raylib, I added GetMouseRayEx, which has new arguments (width and height), making it easier to cast a ray to a specific viewport.

Hey @luis605, nice addition, but you mentionned "GetMouseRayEx" in the PR description, and it's named GetViewRay in the code. As you're using the parameter named mousePosition, I think GetMouseRayEx is better ;)

@luis605
Copy link
Contributor Author

luis605 commented Jan 23, 2024

GetMouseRay did not allow the user to cast a ray from the camera to the world view while in a viewport or renderTexture. To improve raylib, I added GetMouseRayEx, which has new arguments (width and height), making it easier to cast a ray to a specific viewport.

Hey @luis605, nice addition, but you mentionned "GetMouseRayEx" in the PR description, and it's named GetViewRay in the code. As you're using the parameter named mousePosition, I think GetMouseRayEx is better ;)

Hi @Elkantor . I was talking to @raysan5 and @JeffM2501 and we thought GetViewRay was better named than Ex.

@raysan5 raysan5 merged commit 9a5dddc into raysan5:master Feb 4, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Feb 4, 2024

@luis605 @Elkantor Merging but function name still under consideration... GetViewProjectionRay() was also proposed as a more correct description of the functionality... Still GetMouseRayEx() seems more aligned with current API GetMouseRay()... what is the naming that could be more intuitive for new users?

I checked Unity API (that is usually VERY good at naming) and they have: Camera.ViewportPointToRay().
It seems Stride engine uses a more splicit naming (not sure if same behaviour): ScreenPositionToWorldPositionRaycast()
Godot has camera.project_ray_normal(mouse)) that I think it's similar

Do you know what naming is used in other similar libraries/frameworks/engines?

raysan5 added a commit that referenced this pull request Feb 4, 2024
* Update rtext.c

* Add gamepad support to PLATFORM_DESKTOP_SDL (#3776)

Co-authored-by: Arthur <[email protected]>

* [rcore] Fix `GetFileNameWithoutExt()` (#3771)

* Update rcore.c

fix [rcore] GetFileNameWithoutExt

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Review formating and some defines naming consistency

* Added viewport independent raycast (#3709)

* added viewport independent raycast

* Renamed GetMouseRayEx to GetViewRay

* Update raylib_api.* by CI

* REVIEWED: `rlLoadFramebuffer()`, parameters not required

* Reorder functions

* Update raylib_api.* by CI

* Update rtext.c (#3777) (#3779)

* REVIEWED: `rlLoadFramebuffer()`

---------

Co-authored-by: A <[email protected]>
Co-authored-by: Arthur <[email protected]>
Co-authored-by: oblerion <[email protected]>
Co-authored-by: Luís Almeida <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants