diff --git a/examples/core/core_3d_picking.c b/examples/core/core_3d_picking.c
index fa6fcaec3..634afba8c 100644
--- a/examples/core/core_3d_picking.c
+++ b/examples/core/core_3d_picking.c
@@ -60,7 +60,7 @@ int main(void)
{
if (!collision.hit)
{
- ray = GetMouseRay(GetMousePosition(), camera);
+ ray = GetScreenToWorldRay(GetMousePosition(), camera);
// Check collision between ray and box
collision = GetRayCollisionBox(ray,
diff --git a/examples/models/models_loading.c b/examples/models/models_loading.c
index 8b4002d18..d35db347c 100644
--- a/examples/models/models_loading.c
+++ b/examples/models/models_loading.c
@@ -109,7 +109,7 @@ int main(void)
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{
// Check collision between ray and box
- if (GetRayCollisionBox(GetMouseRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
+ if (GetRayCollisionBox(GetScreenToWorldRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
else selected = false;
}
//----------------------------------------------------------------------------------
diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c
index 4530d58a1..15723e39d 100644
--- a/examples/models/models_mesh_picking.c
+++ b/examples/models/models_mesh_picking.c
@@ -88,7 +88,7 @@ int main(void)
Color cursorColor = WHITE;
// Get ray and test against objects
- ray = GetMouseRay(GetMousePosition(), camera);
+ ray = GetScreenToWorldRay(GetMousePosition(), camera);
// Check ray collision against ground quad
RayCollision groundHitInfo = GetRayCollisionQuad(ray, g0, g1, g2, g3);
diff --git a/examples/text/text_draw_3d.c b/examples/text/text_draw_3d.c
index b279f1b36..ed4e6ce67 100644
--- a/examples/text/text_draw_3d.c
+++ b/examples/text/text_draw_3d.c
@@ -195,7 +195,7 @@ int main(void)
// Handle clicking the cube
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{
- Ray ray = GetMouseRay(GetMousePosition(), camera);
+ Ray ray = GetScreenToWorldRay(GetMousePosition(), camera);
// Check collision between ray and box
RayCollision collision = GetRayCollisionBox(ray,
diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json
index 3aec33ef9..8a1594b23 100644
--- a/parser/output/raylib_api.json
+++ b/parser/output/raylib_api.json
@@ -3872,7 +3872,7 @@
]
},
{
- "name": "GetMouseRay",
+ "name": "GetScreenToWorldRay",
"description": "Get a ray trace from mouse position",
"returnType": "Ray",
"params": [
@@ -3887,7 +3887,7 @@
]
},
{
- "name": "GetViewRay",
+ "name": "GetScreenToWorldRayEx",
"description": "Get a ray trace from mouse position in a viewport",
"returnType": "Ray",
"params": [
diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua
index dbcf969f1..1d588fd6d 100644
--- a/parser/output/raylib_api.lua
+++ b/parser/output/raylib_api.lua
@@ -3635,7 +3635,7 @@ return {
}
},
{
- name = "GetMouseRay",
+ name = "GetScreenToWorldRay",
description = "Get a ray trace from mouse position",
returnType = "Ray",
params = {
@@ -3644,7 +3644,7 @@ return {
}
},
{
- name = "GetViewRay",
+ name = "GetScreenToWorldRayEx",
description = "Get a ray trace from mouse position in a viewport",
returnType = "Ray",
params = {
diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt
index 668e84bb6..a0477b660 100644
--- a/parser/output/raylib_api.txt
+++ b/parser/output/raylib_api.txt
@@ -1421,14 +1421,14 @@ Function 083: UnloadShader() (1 input parameters)
Return type: void
Description: Unload shader from GPU memory (VRAM)
Param[1]: shader (type: Shader)
-Function 084: GetMouseRay() (2 input parameters)
- Name: GetMouseRay
+Function 084: GetScreenToWorldRay() (2 input parameters)
+ Name: GetScreenToWorldRay
Return type: Ray
Description: Get a ray trace from mouse position
Param[1]: mousePosition (type: Vector2)
Param[2]: camera (type: Camera)
-Function 085: GetViewRay() (4 input parameters)
- Name: GetViewRay
+Function 085: GetScreenToWorldRayEx() (4 input parameters)
+ Name: GetScreenToWorldRayEx
Return type: Ray
Description: Get a ray trace from mouse position in a viewport
Param[1]: mousePosition (type: Vector2)
diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml
index c04727367..525f81ded 100644
--- a/parser/output/raylib_api.xml
+++ b/parser/output/raylib_api.xml
@@ -902,11 +902,11 @@
-
+
-
+
diff --git a/src/raylib.h b/src/raylib.h
index c8f765ece..3c54abacf 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1049,8 +1049,8 @@ RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
// Screen-space-related functions
-RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Get a ray trace from mouse position
-RLAPI Ray GetViewRay(Vector2 mousePosition, Camera camera, float width, float height); // Get a ray trace from mouse position in a viewport
+RLAPI Ray GetScreenToWorldRay(Vector2 mousePosition, Camera camera); // Get a ray trace from mouse position
+RLAPI Ray GetScreenToWorldRayEx(Vector2 mousePosition, Camera camera, float width, float height); // Get a ray trace from mouse position in a viewport
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position
RLAPI Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position
RLAPI Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position
diff --git a/src/rcore.c b/src/rcore.c
index 024f0d121..5e45a49a9 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -1407,13 +1407,13 @@ void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
//----------------------------------------------------------------------------------
// Get a ray trace from mouse position
-Ray GetMouseRay(Vector2 mousePosition, Camera camera)
+Ray GetScreenToWorldRay(Vector2 mousePosition, Camera camera)
{
- return GetViewRay(mousePosition, camera, (float)GetScreenWidth(), (float)GetScreenHeight());
+ return GetScreenToWorldRayEx(mousePosition, camera, (float)GetScreenWidth(), (float)GetScreenHeight());
}
// Get a ray trace from the mouse position within a specific section of the screen
-Ray GetViewRay(Vector2 mousePosition, Camera camera, float width, float height)
+Ray GetScreenToWorldRayEx(Vector2 mousePosition, Camera camera, float width, float height)
{
Ray ray = { 0 };