mpstark / DynamicCam

A more dynamic camera for World of Warcraft.
MIT License
23 stars 11 forks source link

Add: Zoom to: Last zoom per situation #24

Closed Gaszpard closed 4 years ago

Gaszpard commented 4 years ago

A suggestion regarding a Zoom To option: to save the last used zoom for each situation, and to zoom in/out the camera to that last zoom upon re-entering the situation. This would let users adjust the zoom level for each situation on the fly using the mouse-wheel.

For example if I was out of combat and used the scroll wheel to set the zoom to '14'. Then I entered combat and set the zoom to '5'. Upon leaving combat the camera would automatically zoom out to '14' (last known out-of-combat zoom level), and let's say I used the scroll wheel again and zoomed to '30'. Upon re-entering combat the camera would zoom in back to '5' (last known combat zoom level). Upon leaving combat the camera would zoom out to '30' (last known out-of-combat zoom level).

LudiusMaximus commented 4 years ago

Haha, that's funny. I just finished implementing exactly what you are suggesting. :-) It will come with the next release very soon.

Gaszpard commented 4 years ago

This is gotta be a record for the fastest implementation of a requested feature in WoW Addon history :D. This is great news, thank you!

LudiusMaximus commented 4 years ago

I just put out the release. You find a new option on top of the situations settings. Is this what you had in mind?

Gaszpard commented 4 years ago

This is it exactly! I had a couple of hours to play around with it and it's turned adjusting the camera from a hassle to a delight :).

LudiusMaximus commented 4 years ago

Glad to hear that! The zoom restoring was really somewhat messy before. Let me know if you have other suggestions on how to improve DynamicCam.

LudiusMaximus commented 4 years ago

Also, thanks a lot for your donation!!

Gaszpard commented 4 years ago

No problem :) Months ago I had spent hours trying to get this functionality working but I could never get it to work.

I noticed you added in an 'Adjust shoulder offset according to zoom level' setting to increase the off-set the further you zoom out, which is really cool. Have you tried it the other way around, so that the shoulder-offset increases the further you zoom in? (the closer you are to the character, the higher the off-set goes)

I fiddled around with it a bit and got it working in case you want to try it out (hope you don't mind me nosing through the code).

function DynamicCam:GetShoulderOffsetZoomFactor(zoomLevel)
    -- print("GetShoulderOffsetZoomFactor(" .. zoomLevel .. ")")

    if not DynamicCam.db.profile.shoulderOffsetZoom.enabled then
        return 1
    end

    local startIncrease = DynamicCam.db.profile.shoulderOffsetZoom.lowerBound
    local finishIncrease = DynamicCam.db.profile.shoulderOffsetZoom.upperBound

    local zoomFactor = 1
    if zoomLevel >= finishIncrease then
        zoomFactor = 0
    elseif zoomLevel < finishIncrease then
        zoomFactor = (finishIncrease-zoomLevel) / (finishIncrease)
    end

    -- print("zoomFactor:", zoomFactor)
    return zoomFactor
end
LudiusMaximus commented 4 years ago

I don't mind at all. "Nosing through the code" is how I ended up officially maintaining the addon right now. :-) So please feel free to make you own fork and suggest pull requests if you come up with something cool.

Should we include your "inverted shoulder offset adjustment" as an extra option? The desirability of this has not occured to me yet. What do you like about it?

Gaszpard commented 4 years ago

The way I tend to play is that if I zoom out then I'm probably doing something more intense that requires paying attention to my surroundings and in this case I like to have the camera centered. The off-set makes it harder to know where my character is, especially if there're a bunch of spells on the ground or my character is hidden behind some giant mobs.

But if I zoom in then I'm likely doing something easier or relaxing and I can admire the scenery and animations so having the shoulder-offset really helps with that. I also find the offset useful when clicking on quest-items on the ground and the camera is zoomed in.

I have no idea if many others play like this or if it's just a quirk of mine. But if you think it would also be useful to others then feel free to include it :).