Skip to content

Conversation

@AristurtleDev
Copy link
Collaborator

Description

This pull request adds zoom-to-point functionality to OrthographicCamera, allowing developers to zoom toward a specific world position while keeping that point fixed on screen.

Related Issues/Tickets

Changes Made

OrthographicCamera.cs

  • Added ZoomIn(float deltaZoom, Vector2 zoomCenter) method that zooms in while keeping a world position fixed on screen
  • Added ZoomOut(float deltaZoom, Vector2 zoomCenter) method that zooms out while keeping a world position fixed on screen
  • Both methods include position adjustment formula: Position += (zoomCenter - Origin - Position) * ((newZoom - oldZoom) / newZoom)
  • Position adjustment is skipped when zoom is clamped by MinimumZoom, MaximumZoom, or world bounds to prevent unexpected camera movement

Checklist

Please read and check the following items. Pull requests will not be reviewed if all items are not checked.

  • I have verified that there are no existing pull requests that would overlap with this pull request.
  • I have verified that I am following the guidelines as outlined in this project's contribution policy
  • I have verified that this pull request adheres to this project's code of conduct.
  • I have written a descriptive title for this pull request.
  • I have provided appropriate test coverage were applicable.

@AristurtleDev AristurtleDev merged commit 76c0bf0 into develop Nov 7, 2025
1 check passed
@AristurtleDev AristurtleDev deleted the feature/orthographic-camera-zoom-to-point-625 branch November 7, 2025 01:24
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.

New Zoom functions for the Camera class

2 participants