How can i use the world size without increasing my game's resolution?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gonz4 L

Related to: How can i make the player move by swing? - Archive - Godot Forum

I made the swing mechanic myself but my problem now it’s that i can’t go backwards passing the viewport rect of 1920x1080 pixels:

This is my code:

extends RigidBody2D


const MAX_DISTANCE = 150
export(int) var elastic_factor = 3
var launch_force := Vector2()
onready var rest = $RestPosition

func _on_touch_pressed(_event: InputEventScreenTouch):
	pass

func _on_touch_drag(event: InputEventScreenDrag):
	mode = RigidBody2D.MODE_KINEMATIC
	launch_force = (rest.global_position - event.position).clamped(MAX_DISTANCE)

func _on_touch_released(_event: InputEventScreenTouch):
	mode = RigidBody2D.MODE_RIGID
	apply_central_impulse(launch_force * elastic_factor)
	launch_force = Vector2()

func _unhandled_input(event):
	if event is InputEventScreenTouch:
		if event.pressed:
			_on_touch_pressed(event)
			get_tree().set_input_as_handled()
		else:
			_on_touch_released(event)
			get_tree().set_input_as_handled()
	if event is InputEventScreenDrag:
		_on_touch_drag(event)
		get_tree().set_input_as_handled()
:bust_in_silhouette: Reply From: Gonz4 L

Solved it:

func _on_touch_drag(event: InputEventScreenDrag):
	var event_global = get_canvas_transform().affine_inverse().xform(event.position)
	launch_force = (rest.global_position - event_global).clamped(MAX_DISTANCE)