Godot Version
4.6.3
Question
I’m Transitioning a Camera Movement System To Be Simpler and Cleaning Up Some Things. I Made All The Vector2s, But When I Put Them In, It Is Only Expecting 1 Instead of My Wanted 3. Any Info on Why This is Wrong?
func camera_pan(mouse_pos:Vector2,viewport_size:Vector2,delta:float) -> void:
if mouse_pos.x < CAMERA_PAN_MARGIN: cam_movement_velocity.x = -1 * delta
if mouse_pos.y < CAMERA_PAN_MARGIN: cam_movement_velocity.z = -1 * delta
if mouse_pos.x > viewport_size.x - CAMERA_PAN_MARGIN: cam_movement_velocity.x = 1 *delta
if mouse_pos.y > viewport_size.y - CAMERA_PAN_MARGIN: cam_movement_velocity.z = 1 *delta
func camera_pan(camera: TYPE_RTS_CAMERA,delta:float) -> void:
if Input.get_mouse_mode() != Input.MOUSE_MODE_CONFINED:return
var mouse_pos:Vector2 = get_viewport().get_mouse_position()
var viewport_size:Vector2 = get_viewport().get_visible_rect().size
camera.camera_pan(mouse_pos,viewport_size,delta)
That Last Line is the Error Currently That is Stating it Only is Expecting 1 but I’m Giving it 3.
Dragon145:
I’m Transitioning a Camera Movement System To Be Simpler and Cleaning Up Some Things. I Made All The Vector2s, But When I Put Them In, It Is Only Expecting 1 Instead of My Wanted 3. Any Info on Why This is Wrong?
func camera_pan(mouse_pos:Vector2,viewport_size:Vector2,delta:float) -> void:
if mouse_pos.x < CAMERA_PAN_MARGIN: cam_movement_velocity.x = -1 * delta
if mouse_pos.y < CAMERA_PAN_MARGIN: cam_movement_velocity.z = -1 * delta
if mouse_pos.x > viewport_size.x - CAMERA_PAN_MARGIN: cam_movement_velocity.x = 1 *delta
if mouse_pos.y > viewport_size.y - CAMERA_PAN_MARGIN: cam_movement_velocity.z = 1 *delta
func camera_pan(camera: TYPE_RTS_CAMERA,delta:float) -> void:
if Input.get_mouse_mode() != Input.MOUSE_MODE_CONFINED:return
var mouse_pos:Vector2 = get_viewport().get_mouse_position()
var viewport_size:Vector2 = get_viewport().get_visible_rect().size
camera.camera_pan(mouse_pos,viewport_size,delta)
That Last Line is the Error Currently That is Stating it Only is Expecting 1 but I’m Giving it 3.
Maybe you have somewhere other resolver, try ctrl/cmd+click to camera_pan.