Camera lerp in mobile causing jitter

Get help using Construct 2

Post » Sun Jan 31, 2016 4:27 pm

Hey guys,

I'm having jitter in my game when testing on mobile. I figured out that the lerp in my camera object (smooth scrolling) is causing this. The movement in my game is very similar to Asteroids (Custom Movement). Here's what I'm using for the camera at the moment:

Every tick|Camera -> Set position to lerp(Self.X, Player.X, 0.08), lerp(Self.Y, Player.Y, 0.08)

Is there any way to get a smooth scrolling camera in mobile without jitter/lag?
"If you don't build your dream, someone else will hire you to build theirs"
B
12
S
3
G
1
Posts: 53
Reputation: 905

Post » Sun Jan 31, 2016 5:09 pm

Instead of a fixed value of 0.08, do 4.8*dt which will take into account changes in framerate
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
31
S
9
G
7
Posts: 438
Reputation: 6,694

Post » Sun Jan 31, 2016 5:46 pm

OddConfection wrote:Instead of a fixed value of 0.08, do 4.8*dt which will take into account changes in framerate

That fixed it, thanks! Tried adding dt in there before but wrote it wrong way in the expression.
"If you don't build your dream, someone else will hire you to build theirs"
B
12
S
3
G
1
Posts: 53
Reputation: 905

Post » Sun Jan 31, 2016 5:51 pm

VValt wrote:Hey guys,

I'm having jitter in my game when testing on mobile. I figured out that the lerp in my camera object (smooth scrolling) is causing this. The movement in my game is very similar to Asteroids (Custom Movement). Here's what I'm using for the camera at the moment:

Every tick|Camera -> Set position to lerp(Self.X, Player.X, 0.08), lerp(Self.Y, Player.Y, 0.08)

Is there any way to get a smooth scrolling camera in mobile without jitter/lag?


Things you should know for mobile smooth performance of lerp and camera:
1.( Use delta-time for frame dependence like 1.0 * dt)
2.If it isn't enough then use make it faster especially in older devices. So that the jitter won't be noticed.
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
54
S
17
G
90
Posts: 1,111
Reputation: 59,120


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests