Smooth camera follow

  • #1, by fulviovFriday, 06. February 2015, 17:19 6 years ago
    Hi,
    I was thinking that it would be nice to have the possibility to have a smooth camera follow, instead of the "hard stop" we have right now when the camera gets in place.
    Something like this:

    I have found this in the forum:
    http://www.visionaire-studio.net/forum/thread/smooth-scrolli...

    the script however needs a lot of tweaking, and for some reason sometimes it gets stuck in some rooms.
    I'll try to tweak it more, but I think an editor option to get this done with 1 click would be better smile

    Forum Fan

    119 Posts


  • #2, by afrlmeFriday, 06. February 2015, 17:44 6 years ago
    Hmm I believe Simon intended to replace the current camera with the openGL one. Since 4.1 or 4.0.1 (I forget which version) you could return the size (height & width) of any sprite (image) which means you could get the size of the scene background which could be used to prevent the camera in the shaderFollowCharacter() function from going past the scenes background. This would probably be the best way of having the camera smoothly follow the character or mouse (whichever you decide to assign it to).

    Imperator

    6846 Posts

  • #3, by fulviovSaturday, 07. February 2015, 21:08 6 years ago
    I had a quick look at the shader toolkit and shaderFollowCharacter() seems indeed the way to go, but yeah, there is the viewport overflow problem with the backgrounds. I'll see if I can manage to modify the function to not go over the limit and behave like the standard camera smile

    Forum Fan

    119 Posts

  • #4, by afrlmeSaturday, 07. February 2015, 21:21 6 years ago
    My solution to that would be to create a function which I would call at the beginning of each playable scene once to get the width & height of the scene. I would then add some if queries to the scroll function inside of the shader toolkit script to prevent overflow. I can't give you a script off the top of my head though.

    Imperator

    6846 Posts

Write post