world: added grass and sky #5
1 changed files with 11 additions and 4 deletions
|
|
@ -7,8 +7,10 @@ var locked_mouse_positon = Vector2(0,0)
|
|||
var mouse_locked = false
|
||||
var mouse_x_velocity = 0
|
||||
var mouse_y_velocity = 0
|
||||
|
||||
var zoom_min = 4
|
||||
var zoom_max = 100
|
||||
var zoom_max = 80
|
||||
var zoom_speed = 20
|
||||
var current_zoom = 8
|
||||
|
||||
func reset():
|
||||
|
|
@ -27,9 +29,9 @@ func _input(event):
|
|||
mouse_x_velocity = event.relative.x
|
||||
mouse_y_velocity = event.relative.y
|
||||
elif event.is_action_pressed("zoom_out"):
|
||||
current_zoom += 5
|
||||
current_zoom += 1
|
||||
elif event.is_action_pressed("zoom_in"):
|
||||
current_zoom -= 5
|
||||
current_zoom -= 1
|
||||
|
||||
func _process(delta):
|
||||
# rotate outer gimbal around y axis
|
||||
|
|
@ -65,4 +67,9 @@ func _process(delta):
|
|||
reset()
|
||||
|
||||
current_zoom = clamp(current_zoom, zoom_min, zoom_max)
|
||||
$InnerGimbal/Camera3D.position = Vector3($InnerGimbal/Camera3D.position.x, current_zoom, current_zoom)
|
||||
|
||||
var pos = Vector3($InnerGimbal/Camera3D.position)
|
||||
pos.y = lerp(pos.y, float(current_zoom), zoom_speed*delta)
|
||||
pos.z = lerp(pos.z, float(current_zoom), zoom_speed*delta)
|
||||
|
||||
$InnerGimbal/Camera3D.position = pos
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue