Resource icon

Zoom to Mouse 1.0.1

Thanks. Yes I updated the driver in the first place.

It may be something related to my multiple monitor setup. Pressing Alt+Tab seems to trigger the error message
Maybe it's something like this:


Or you could try posting the log to the Windows support forum and see what they say.
 

misterener

New Member
Hello, guys, thanks for this awesome script. I installed it on two computers and it works fine on one but I get a black screen when it is activated on the other computer. Both have OBS 30.0.2. The only difference is that the one that is not working is using Windows 11. Any guesses?
 

albertocv

Member
Maybe it's something like this:


Or you could try posting the log to the Windows support forum and see what they say.
Thanks.
I'll post there as soon as I can replay the problem.
 
Hello, guys, thanks for this awesome script. I installed it on two computers and it works fine on one but I get a black screen when it is activated on the other computer. Both have OBS 30.0.2. The only difference is that the one that is not working is using Windows 11. Any guesses?
Enable debug logging in the script settings and look for any errors.

It's probably failing to get the size of the source (or similar) and you might need to set the manual override settings.
 

Wolfbane

Member
Is it possible to "track the mouse" but only do it in a separate small extra window in OBS?

Lets say I am playing an FPS game, and Im sniping, then viewers can use channel points to spring in an extra smaller window in the top right corner that has a small zoomed-in window, so they can see how horrible aimer I am, or how amazing I am?

So.... how would one make a smaller window that only tracks the mouse, but does not affect the general OBS stream area, but only for that small window I make at the desired size?
 

jenks_

New Member
Is it possible to tell the filter to stay in a certain position? You can move the filter but it always goes back to the bottom after switching scenes.
 
Is it possible to tell the filter to stay in a certain position? You can move the filter but it always goes back to the bottom after switching scenes.
If you mean the order of the zoom filter in the list of filters applied to the source, no, not without changing the script.

You can take a look at this GitHub issue:


You essentially have to change line 733, but you'll want to use something like obs_source_filter_set_index to set which position it goes to.
 

jenks_

New Member
If you mean the order of the zoom filter in the list of filters applied to the source, no, not without changing the script.

You can take a look at this GitHub issue:


You essentially have to change line 733, but you'll want to use something like obs_source_filter_set_index to set which position it goes to.
Awesome thank you! That worked perfectly so the zoom works with my 3D filter and rounded corners.

Only issue I'm having now is with a Shadow filter.

Not zoomed in, shadow looks normal:

Screenshot 2024-02-05 211151.png


When zoomed in, 3D effect and rounded corners work as expected, but shadow looks weird. This happens even if I move the Shadow filter to a different location:

Screenshot 2024-02-05 211201.png
 
I'm not familiar with either of those filter effects, so I'm not going to be much use here. I guess the crop/pad filter must mess up the shadow's calculations somehow (but that probably means it would do so even if you manually added a crop/pad with similar settings).

Maybe you could add a fake (something like an image) source, that is the exact same size as your current source, hidden behind it and apply the shadow to that instead of the source with the zoom.
 
Is it possible to "track the mouse" but only do it in a separate small extra window in OBS?

Lets say I am playing an FPS game, and Im sniping, then viewers can use channel points to spring in an extra smaller window in the top right corner that has a small zoomed-in window, so they can see how horrible aimer I am, or how amazing I am?

So.... how would one make a smaller window that only tracks the mouse, but does not affect the general OBS stream area, but only for that small window I make at the desired size?
If you are playing an fps game, I suspect your mouse is always locked to the center of the game screen. So you probably wouldn't need my script to do what you suggest. Just add a new source and crop it so that its always just showing the center of the screen at a bigger size, and then turn that source on and off.

It would probably be easier than trying to get obs-zoom-to-mouse to work for it.
 

B2Run

New Member
Hi, thanks for this great script! It works great... until today: Now it give me this log error message:
[obs-zoom-to-mouse.lua] Failed to call hotkey_pressed for hotkey_pressed: [string "C:/Program Files/obs-studio/data/obs-plugins/..."]:567: attempt to perform arithmetic on field 'x' (a nil value)
I just changed the screen assigned to the source I need to zoom and nothing else. What may have happened?
 
Hi, thanks for this great script! It works great... until today: Now it give me this log error message:
[obs-zoom-to-mouse.lua] Failed to call hotkey_pressed for hotkey_pressed: [string "C:/Program Files/obs-studio/data/obs-plugins/..."]:567: attempt to perform arithmetic on field 'x' (a nil value)
I just changed the screen assigned to the source I need to zoom and nothing else. What may have happened?
What version of the script are you using? I don't see anything relevant on line 567
 

B2Run

New Member
Can you enable debug logging in the script and share the log? Line 567 doesn't match anything, so it must be somewhere else.
here is the log script:

[obs-zoom-to-mouse.lua] Current settings:
[obs-zoom-to-mouse.lua] {
[obs-zoom-to-mouse.lua] monitor_override_x = 0,
[obs-zoom-to-mouse.lua] monitor_override_y = 0,
[obs-zoom-to-mouse.lua] monitor_override_w = 1920,
[obs-zoom-to-mouse.lua] monitor_override_h = 1080,
[obs-zoom-to-mouse.lua] debug_logs = true,
[obs-zoom-to-mouse.lua] use_auto_follow_mouse = true,
[obs-zoom-to-mouse.lua] use_follow_outside_bounds = false,
[obs-zoom-to-mouse.lua] follow_speed = 0.25,
[obs-zoom-to-mouse.lua] follow_border = 8,
[obs-zoom-to-mouse.lua] follow_safezone_sensitivity = 4,
[obs-zoom-to-mouse.lua] use_follow_auto_lock = false,
[obs-zoom-to-mouse.lua] zoom_value = 2,
[obs-zoom-to-mouse.lua] zoom_speed = 0.06,
[obs-zoom-to-mouse.lua] use_monitor_override = false,
[obs-zoom-to-mouse.lua] }
[obs-zoom-to-mouse.lua] Zooming in
[obs-zoom-to-mouse.lua] Failed to call hotkey_pressed for hotkey_pressed: [string "C:/Program Files/obs-studio/data/obs-plugins/..."]:567: attempt to perform arithmetic on field 'x' (a nil value)
 
It looks like it didn't try to initialize the zoom source. Can you try setting zoom source to None and then reselecting whatever source you are trying to use?
 

B2Run

New Member
I haven't None but just the list of my screen sources. Anyway it's like it confuse zoom screens areas; sometimes it zoom but if follow mouse on another screen. Moreover I realize that the script stop to work like before after I changed the connnection of my 3 phisical screens
 
I haven't None but just the list of my screen sources. Anyway it's like it confuse zoom screens areas; sometimes it zoom but if follow mouse on another screen. Moreover I realize that the script stop to work like before after I changed the connnection of my 3 phisical screens
If you don't see the option for <None> in the zoom source dropdown you might not be on the latest version of the script. Try redownloading the latest and adding it to obs.
 

B2Run

New Member
I tried two times to delete the script from OBS panel and then renistall the last version, but the problems remains. There is other files to delete to do a clean setup? (In any case, thanks of your support!)
 
I tried two times to delete the script from OBS panel and then renistall the last version, but the problems remains. There is other files to delete to do a clean setup? (In any case, thanks of your support!)
There isn't anything more to it than just deleting the script from OBS, it's just the single Lua file.

What version of OBS are you using? Is it 29? Do you have any other scripts or plugins that might be interfering with it? I'm not sure what else to suggest. Did you restart OBS between removing and re-adding the script? Maybe something got cached.
 
Top