Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fisox.zero |
(title)
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fisox.zero |
(title)
Reply From: | SingingApple |
All you need is here: Camera2D — Godot Engine (3.0) documentation in English
Check out the last option in the member variables.
You should be able to use that to change the zoom in script. I don’t know how the code will look like bcoz I don’t use Godot 3 .
Reply From: | Ulukanovich |
Hello! I’m from Russia. Sorry for my English.
I use this way:
func zoom():
if Input.is_action_just_released(wheel_down'):
$Camera2D.zoom.x += 0.25
$Camera2D.zoom.y += 0.25
if Input.is_action_just_released('wheel_up') and $Camera2D.zoom.x > 1 and $Camera2D.zoom.y > 1:
$Camera2D.zoom.x -= 0.25
$Camera2D.zoom.y -= 0.25
func _physics_process(delta):
zoom()
hey, do you know how I would create a maximum zoom?
Amateur.game.dev. | 2021-03-06 20:56
Reply From: | TheYellowArchitect |
Ulukanovich’s answer doesn’t work as it is in 4.0, so I converted it for 4.0:
extends Camera2D
func zoom():
if Input.is_action_just_released('wheel_down'):
set_zoom(get_zoom() - Vector2(0.25, 0.25))
if Input.is_action_just_released('wheel_up'): #and get_zoom() > Vector2.ONE:
set_zoom(get_zoom() + Vector2(0.25, 0.25))
func _physics_process(delta):
zoom()
The differences are:
I keep coming across people saying that X doesn’t work for Godot 4 and providing a solution just for that and I made an account just to start saying thank you. It’s helping me so much in learning the engine and starting off on 4.
TheFoxKnocks | 2023-04-29 16:40
I am happy to hear that my reply helped! Godot 4 is insanely powerful, and what prevents users from tapping into that power is not something lacking in the engine, but users cannot understand how to use something (lack of documentation)
Documentation has already heavily improved in the last few months, just like its stability (both of which are Godot’s Achilles’ heel)
I hope whatever feature you want for your game, you find good documentation, may that be text, video or even a full demo
TheYellowArchitect | 2023-04-30 16:24
Hi, I understand the chances of getting an answer are slim)
Is it possible to add smoothness to the zoom and set only three positions, zoom in, return as it was and zoom out, but all this is not maximal, but within the specified parameters?
I tried to figure it out with tween, spent a day, but still couldn’t do it. I would be grateful for an answer)
yes ofc
by
var camerazoom
func _physics_process(delta):
if camerazoom <1000
camerazoom +=2
just change the camerazoom to the actual camerazoom