BlankSourceCode / obs-zoom-to-mouse

An OBS lua script to zoom a display-capture source to focus on the mouse
286 stars 27 forks source link

Delay When Zooming in for the Tracking to Begin #3

Closed andilippi closed 10 months ago

andilippi commented 10 months ago

First off, thank you for this script! It's fantastic and so user friendly. It's great to have an option that doesn't require Python, which can be a little overwhelming for non programmers. So awesome stuff!

I have noticed that when you hit a hot key to zoom in whilst 'Auto Follow Mouse' mode is active. It seems to take a long time until the mouse is actually followed.

I am not sure if this is just a me issue or just the most optimal the script can be. Please let me know as I will be making a video on it for my channel in the next few days!

Again, thank you so much for creating this!

BlankSourceCode commented 10 months ago

Can you try changing the Follow Border setting to full, and see if it still has a follow delay for you.

The way the script works is that when you press zoom it will use the current mouse position at the time of the hotkey press as the center of the zoom. Then it gives you a safe zone to move your cursor in without it moving the "camera". The idea was that you'd want to zoom in somewhere and move your mouse around to highlight code or whatever, without the screen moving so it would be easier to read stuff in the video.

When you move your mouse to the edge of the zoom area, it will then start tracking the cursor and follow it around at the Follow Speed. It will continue to follow it until you hold the mouse still for some amount of time determined by Lock Sensitivity at which point it will stop following and give you that safe zone again.

How close you need to get to the edge of the zoom to trigger the 'start following mode' is determined by the Follow Border. If you set it to full (50%) it will begin following the mouse whenever it gets closer than 50% to an edge, which of course is all the time. Setting a smaller number will give you a bigger safe zone that you can move the mouse in before following kicks in. Setting it to 0, will mean it won't follow until the cursor touches the edge of the zoom area.

Of course, this all assumes there isn't an actual bug somewhere.

If you still have the issue, could you turn on Debug logging and reply with a copy of what it writes into the script log, as well as what settings you are using.

Thanks for trying out the script!

BlankSourceCode commented 10 months ago

With #6 I made it so that tracking will happen during the zoom animation in case you moved your mouse out of the area while it was zooming so it should attempt to keep the cursor on screen immediately (unrelated to the new Auto lock setting).

You could also try the Follow outside of bounds setting, because without that the tracking will stop if you move the mouse out of the unzoomed crop area, which can cause it to feel bad if you are trying to pan to an edge.

Let me know if the tracking still seems to have a delay for you, or if you have any other suggestions on how to improve how the tracking logic works.

BlankSourceCode commented 10 months ago

@andilippi Let me know if you still see delay issues with the latest version of the script, or what else I can do to make it work better for your video. Thanks!

andilippi commented 10 months ago

It seems perfect now! The only other thing I have an issue with is nesting scenes or using the Source Clone plugin. I see someone raised that issue though!

Thanks for getting back to me so quickly.

BlankSourceCode commented 10 months ago

@andilippi Having a display capture source nested in scenes should be supported with the latest script. As in you have sceneA with a display capture source, then you have a different sceneB, and in there you add your existing sceneA.

So if it looks like:

SceneB -> SceneA -> Display

Then that should work as the script will look for the zoom source by recursing into all the scenes in the current scene. If you still see an issue with that, please let me know.

For the Source-Clone plugin, do you mean obs-source-clone? And if so, are you using it to clone the display capture source, or to clone a Scene (that has a display capture in it ... or maybe even nested in another scene, gulp)?

andilippi commented 10 months ago

Nested scene works perfectly. Source Clone does not though. (That was the plugin i meant btw).

I have tried both using the Display Capture as the clone as well as using the Nested Scene too and neither work. I get the following error in the log:

Warning: Source not part of the current scene hierarchy

I guess you just need to add checking for the source clone source type?

Thanks again for the speedy replies!

BlankSourceCode commented 10 months ago

@andilippi I've added a new Show all sources checkbox to allow you to select any source (which means you can pick a cloned source). It's disabled by default because non-display capture sources are much harder for the script to automatically control.

If you enable the settings, you should be able to pick your cloned source, but you will probably need to also enable Set manual source positions and update the values there, because the auto calculations will be wrong (unless you happen to be cloning your primary monitor at 1:1 scale).

It will probably take some playing around with the settings, and crop/pad filters to get it to work correctly, so it's likely for more advanced users that don't mind spending time figuring it out.

Hopefully that at least enables your scenario, even if it's not as straight-forward as a regular display source.

Good Luck!