Skip to content

Camera zoom. Am I an idiot? #19014

Answered by PierreGordo
PierreGordo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thank you for your reply.

Unfortunately the bevy cheat book is quite outdated and the syntax has changed, but your answer put me on the right track and I managed to put together some well-enough working code. Now there is still some goofiness happening (if you zoom in too much, you start zooming out instead of in), but overall I am happy with the results. For anyone searching how to zoom in bevy 0.16 here is my amateurish attempt.

// The "Single" in the query says that there is only one element that matches these parameters so I don't have to for loop later
fn zoom_camera(mouse_wheel: Res<AccumulatedMouseScroll>, camera_query: Single<&mut Projection, With<Camera>>){

    //Since proje…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@PierreGordo
Comment options

Answer selected by PierreGordo
@akimakinai
Comment options

@PierreGordo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants