HUMP camera zoom smoothing?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

HUMP camera zoom smoothing?

Post by togFox »

I'm using the HUMP camera and got what I wanted in less than 15 minutes which is fantastic.

It has movement smoothing (x/y movement) but it doesn't seem to have zoom in/out smoothing. The zoom jars quickly and suddenly and checking if I'm missing something?

I'm happy to "roll my own" zoom smoother for HUMP.Camera but obviously won't if I don't have to. Cheers.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: HUMP camera zoom smoothing?

Post by togFox »

The other thing I'm trying to do is zoom and pan around while the score remains locked at the top of the screen. This seems very difficult with HUMP. If I draw something in the world at 50,50 (for example) and then pan the camera down then that score moves off the top of the screen.

"Easy" I think - I'll just redraw that score at the new X,Y location so that it appears to be locked at the top. It seems that determining that new X,Y is not straight forward.

worldcoord doesn't do this and cameracoord is not explained/documented (and doesn't do what I want). Anyone had this problem before?
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
dezoitodemaio
Prole
Posts: 15
Joined: Mon Oct 26, 2020 2:02 pm

Re: HUMP camera zoom smoothing?

Post by dezoitodemaio »

why not just tween the parameter passed to camera.zoomTo function?
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: HUMP camera zoom smoothing?

Post by pgimeno »

Why not draw the score after finishing the camera?
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: HUMP camera zoom smoothing?

Post by togFox »

I have rolled my own zoom smoothing but wanted to make sure I wasn't missing something obvious.

The way hump seems to work is that zooming or scrolling will move objects off screen when the camera moves. The origin (top left corner) is actually off the screen. The origin doesn't reset - meaning I no longer have a point of reference to draw/refresh fixed objects.

Hard to explain. An object that is drawn at 0,0 before the scroll needs to be redrawn at (x,y) but it's not clear how hump can tell me what this new x,y value is. If I could determine the new x,y after the camera movement then I could redraw fixed objects in the right place in a hopefully seamless way.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
4vZEROv
Party member
Posts: 126
Joined: Wed Jan 02, 2019 8:44 pm

Re: HUMP camera zoom smoothing?

Post by 4vZEROv »

Those 2 functions do convert world coords and camera coords.

Camera coords are what you see on the screen.
World coords are where coords actualy are in your logic.

(or maybe it's the other way :^) )

Code: Select all

function camera:cameraCoords(x,y, ox,oy,w,h)
function camera:worldCoords(x,y, ox,oy,w,h)
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: HUMP camera zoom smoothing?

Post by zorg »

Maybe the "origin" is not the topleft in a camera system but the middle of the viewport perhaps?

Also, score is usually part of the GUI that shouldn't be affected by world camera transforms anyway, as pgimeno said above.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: HUMP camera zoom smoothing?

Post by togFox »

Yes - the origin of the viewport - or the screen origin relative to the world's origin is tricky to track.

I need to play with it more to understand where the score needs to be drawn each time the camera moves because currently it scrolls off-screen when the camera moves.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: HUMP camera zoom smoothing?

Post by zorg »

togFox wrote: Wed Feb 17, 2021 7:59 am I need to play with it more to understand where the score needs to be drawn each time the camera moves because currently it scrolls off-screen when the camera moves.
It needs to be drawn after you draw everything related to the world and you stop using hump.camera's transformation stack; its position should not be affected by the camera at all.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: HUMP camera zoom smoothing?

Post by togFox »

Gosh - as simple as that:

Code: Select all

camera:attach()
-- do stuff
camera:detach()	

DrawScores()	-- draw this after the camera stuff
As suggested - I did this drawing outside the camera manipulation and it worked instantly. I don't know how long it would have taken me to stumble across that accidentally. Thanks!!
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 58 guests