Trouble when using screen to world at 1980x1080 (rendercam)

I’m trying to get a collision object to follow the mouse pointer.

It works perfectly fine at 1280x720, but when I switch the resolution to 1920x1080 in game project, it offsets, and I have no idea how to fix that. It also seems that the offset gets bigger as you get farther away from the bottom left corner of the screen.

This is the code where it happens:

function on_input(self, action_id, action)
	if action_id == nil then
		local pos = rendercam.screen_to_world_2d(action.x, action.y)
		print(action.x .. ", " .. action.y) 
                 -- this was to see the screen position
        	go.set_position(pos)
	end
end

Any ideas to fix the problem? Thanks.

I think it should be action.screen_x and y

1 Like

Really? Let me try that.