Skip to content

Conversation

@Cartier32
Copy link
Collaborator

@Cartier32 Cartier32 commented Oct 23, 2024

Objective

  • This PR addresses issue Create camera system #3. It proposes implementations for the game's camera system using bevy's cameras. This plugin has one mainCamera marker component that tracks an entity with the cameraTarget component. This plugin also handles the creation of the main camera, and the zooming in/out of the main camera.

Solution

  • The solution to this issue was to use Bevy's built in camera system and then modifying camera attributes to achieve the behavior that I was looking for. Looked at Bevy's camera examples and the Bevy guide book to help me come to my solution.

New components

  • MainCamera: Component that marks the main camera of our game
  • CameraTarget: Component that marks the main camera's target

New systems

  • setup_main_camera: Creates and sets up the main camera for our game
  • update_camera: Updates the main camera's translation to the entity with the CameraTarget marker's translation
  • zoom_camera: Zooms the camera in or out depending on mouse wheel input. Modifies Main Camera's projection scale.
  • display_dudes: Added system to the debug_plugin that displays some sprites. One stationary sprite, then one sprite that continuously falls that the camera tracks. Can also zoom in and out during this state.

Testing

  • I tested these changes through the debug plugin, spawned some entities to track and it was tracking, zoom also works
  • Don't believe that anything needs anymore testing
  • Refer to the debug plugin if you would like to test changes, comments explain everything

@Cartier32 Cartier32 linked an issue Oct 23, 2024 that may be closed by this pull request
@Cartier32 Cartier32 force-pushed the feature/3/camera-system branch from 8490f60 to 3ed9e27 Compare October 27, 2024 03:21
Copy link
Collaborator Author

@Cartier32 Cartier32 left a comment

Choose a reason for hiding this comment

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

Incorporated all changes, thanks for an in depth review 💯

@Cartier32 Cartier32 requested a review from Remi-Godin October 27, 2024 04:54
@Cartier32 Cartier32 requested a review from Remi-Godin November 5, 2024 09:32
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.

Create camera system

3 participants