How do I interpolate to new camera target?

Get help using Construct 2

Post » Mon Jan 05, 2015 10:02 pm

Hi,
does C2 offer a convenient way to actually smoothly scroll to a different camera position? when using the system action 'scroll to object' or the scroll behaviour the camera in fact jumps to the new position upon triggering, but I'd need the camera to smoothly move from it's original position to the new target postion.

Anyone got a good idea to avoid having to write some complicated expressions?
B
15
S
7
Posts: 244
Reputation: 2,065

Post » Mon Jan 05, 2015 10:15 pm

Just lerp over there - something like "Every tick - ScrollX = lerp(ScrollX,TargetX,dt*128) <== Change this number to change speed
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Mon Jan 05, 2015 10:36 pm

Good call, thx.
I'm getting a jittery cam shaking when doing this:

CameraLerp.PNG


Can you tell me what I'm doing wrong here?
You do not have the required permissions to view the files attached to this post.
B
15
S
7
Posts: 244
Reputation: 2,065

Post » Tue Jan 06, 2015 12:53 pm

um, re-reading your reply I'm guessing I ought to add a variable that i interpolate from and then update the cam position. I might we strating the lerp from 400,300 over and over with what i'm doing
B
15
S
7
Posts: 244
Reputation: 2,065

Post » Tue Jan 06, 2015 12:59 pm

Exactly - you need to interpolate from the current camera position to the desired one. Why I put "ScrollX" in the example.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Tue Jan 06, 2015 1:08 pm

facecrime wrote:Good call, thx.
I'm getting a jittery cam shaking when doing this:

CameraLerp.PNG


Can you tell me what I'm doing wrong here?


look this example ;)
You do not have the required permissions to view the files attached to this post.
B
21
S
9
Posts: 298
Reputation: 2,967


Return to How do I....?

Who is online

Users browsing this forum: work3 and 6 guests