Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Glenjamin on Sun 13/09/2015 21:53:08

Title: Smooth camera movement
Post by: Glenjamin on Sun 13/09/2015 21:53:08
How can I move the camera smoothly from one point to another? I'm aware of the SetViewport() function, but that just jumps the camera from one place to another.
I need a nice smooth pan for a dramatic moment. Thanks!
Title: Re: Smooth camera movement
Post by: Jack on Sun 13/09/2015 22:41:17
You can use SetViewport() with repeatedly_execute or repeatedly_execute_always to move the viewport 1, 2 or 3 pixels each frame. Just remember to call ReleaseViewport() when you're done.
Title: Re: Smooth camera movement
Post by: Snarky on Sun 13/09/2015 22:48:58
Or even simpler, with the Tween module, you can tween the viewport position, which will give a smooth camera move effect.
Title: Re: Smooth camera movement
Post by: Ali on Mon 14/09/2015 12:34:17
The Tween module will give great results, but if you want smoother camera movement in general then you could also try my Smooth Scrolling and Parallax Module: http://www.adventuregamestudio.co.uk/forums/index.php?topic=33142.msg636501798#msg636501798

You can create pans and more complex camera moves by directing the camera to an invisible character (targetCharacter = cDummy;).
Title: Re: Smooth camera movement
Post by: Monsieur OUXX on Tue 15/09/2015 15:13:35
+1 for "Smooth Scrolling & Parallax" module
Title: Re: Smooth camera movement
Post by: Snarky on Tue 15/09/2015 16:27:07
If you're not using parallax, is there any benefit to using that module over Tween?
Title: Re: Smooth camera movement
Post by: Monsieur OUXX on Wed 16/09/2015 09:11:26
Quote from: Snarky on Tue 15/09/2015 16:27:07
If you're not using parallax, is there any benefit to using that module over Tween?
I haven't tried tween 2.0 and its new magic (including tweening the viewport). So the answer is: Tween is probably doing it right, but you'd need to script a little, and watch out for the potential corner cases, whereas Smooth scrolling works out of the box and is flawless.