Help needed with camera lerp (jerkiness)

0 favourites
  • 11 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I've started implementing gamepad controls in my game. Everything is good, except the camera (crosshair) lerp... When the camera reaches its max distance the player and the surrounding objects start shaking. It stops when the camera's position stabilizes. It's really annoying, see the video below:

    Subscribe to Construct videos now

    Here is the online demo: hgwd.net/mgc/index.html

    And my project: hgwd.net/downloads/MGC-v293.c3p

    I've done a lot of research on the forum yesterday. And I've tried many solutions but nothing works. I need help. How can I prevent the shaking or is there any trick I can use to mitigate the oscillation/jerkiness?

    Thank you.

  • It took me a while to understand your code. The Aim_Analog_Dev is moved with Bullet behavior and you are using lerp to return it back to the player. As a result, Bullet and lerp are "fighting" with each other, that's why you have the jitter.

    That's a weird method and I don't recommend using it.

    You can do the same easier with MoveTo behavior. Remove Bullet and events 334-337. Add MoveTo, you can experiment with speed and acceleration/deceleration values. 300 in the screenshot below is the max distance to the player.

  • Thank you for taking the time to help Dop. I hope the code wasn't too confusing. I'm gradually trying to improve the organization as I build and learn. It's my first project. I think I've improved a great deal since I started using Construct a year ago. Still have a long way to go. Anyways, I'm working this morning, but I will try your method after and let you know how it pans out. Much appreciated sir.

  • Amazing, I can work with this 100%!

    Would you recommend rounding the player co-ordinates like this?

    round(Player.ImagePointX("Aim_Center"))+100*cos(a)

    round(Player.ImagePointY("Aim_Center"))+100*sin(a)

    I was still seeing a bit of jerkiness, but 90% less. So I added the rounding and repositioned some of the objects to x, y integers and as far as I can tell that eliminates the jerkiness. Except for the player, since the player's x position is never set to a round number. I'll continue testing and tweaking after work tonight.

    I'm very grateful, thank you Dop!

    Edit:

    Also, first time using the MoveTo behavior. I'll read the docs and play around with it. Seems like it could be super useful.

  • Hey I sell an asset to fix this exact problem if you'Re interested

    construct.net/en/game-assets/game-templates/pixel-perfect-resolution-554

    are posts like this allowed?

  • Hi Eleanor, thank you for letting me know. I'll keep an eye on it for sure. At the moment I seem to be on track to fixing everything. The second screenshot you posted in the description helped. I wasn't aware I should avoid using odd numbers for my sprites. I've also started making sure all my imagepoints are set to integers.

  • the odd number problem is when you import them, having odd imagepoints is ok !!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Right. Just no decimals for the imagepoints then. Thank you.

  • You seemed really experienced with Construct Eleanor. Did you publish anything?

  • No, I don'T have anything published but I've been working on this project for a while

    Subscribe to Construct videos now
  • It's very impressive! Is it an MMO? Btw, I've spent more time looking at your template and I will most likely purchase it today or tomorrow. Hopefully it will eliminate the remaining oscillation in my game. Thank you for taking the time to answer my questions today. Excellent support!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)