summaryrefslogtreecommitdiffhomepage
path: root/examples/models/models_mesh_picking.c
diff options
context:
space:
mode:
authorCrydsch Cube <[email protected]>2023-02-14 17:47:21 +0100
committerGitHub <[email protected]>2023-02-14 17:47:21 +0100
commit73989a49817225f11f547d270598e93745bf7df0 (patch)
treec5ab826343e7b131c1e3733924156add0d445dbc /examples/models/models_mesh_picking.c
parentf1bcabcc3799df741d54593980ac06afe2e0f081 (diff)
downloadraylib-73989a49817225f11f547d270598e93745bf7df0.tar.gz
raylib-73989a49817225f11f547d270598e93745bf7df0.zip
WIP rcamera redesign vector (#2563)
* core functionality CAMERA_FREE * fix example * add remaining camera modes * add view bobbing * view bobbing * catch curser in SetCameraMode * adjust examples * fix compilation on linux * fix example text_draw_3d * actually fix text_draw_3d * Updated camera API * Improve Vector3RotateByAxisAngle() function * remove camera.mode dependency from low-level functions * remove camera.mode from struct * fixes after rebase * adjust examples for new UpdateCamera function * adjust example models_loading_m3d --------- Co-authored-by: Ray <[email protected]>
Diffstat (limited to 'examples/models/models_mesh_picking.c')
-rw-r--r--examples/models/models_mesh_picking.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c
index 52f9974d..1118168c 100644
--- a/examples/models/models_mesh_picking.c
+++ b/examples/models/models_mesh_picking.c
@@ -64,8 +64,7 @@ int main(void)
Vector3 sp = (Vector3){ -30.0f, 5.0f, 5.0f };
float sr = 4.0f;
- SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
-
+ EnableCursor(); // Disable camera controls
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -73,7 +72,14 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
- UpdateCamera(&camera);
+ if (IsCursorHidden()) UpdateCamera(&camera, CAMERA_FIRST_PERSON); // Update camera
+
+ // Toggle camera controls
+ if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT))
+ {
+ if (IsCursorHidden()) EnableCursor();
+ else DisableCursor();
+ }
// Display information about closest hit
RayCollision collision = { 0 };
@@ -219,7 +225,7 @@ int main(void)
DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
}
- DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
+ DrawText("Right click mouse to toggle camera controls", 10, 430, 10, GRAY);
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);