Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Search
Login
Register
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Camera accelerate and decelerate with scroll
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Camera accelerate and decelerate with scroll (Read 2872 times)
kkl
float
Posts: 291
Camera accelerate and decelerate with scroll
«
on:
December 15, 2014, 02:29:40 am »
Hi,
Has anyone tried camera smooth scrolling before? Something like, the camera accelerates based on velocity and slows down(decelerate) when the touch event stops.
«
Last Edit: December 15, 2014, 02:33:59 am by kkl
»
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Camera accelerate and decelerate with scroll
«
Reply #1 on:
December 15, 2014, 07:53:17 am »
Should be simple to do. Or do you have any issues with it?
Logged
kkl
float
Posts: 291
Re: Camera accelerate and decelerate with scroll
«
Reply #2 on:
December 15, 2014, 08:59:49 am »
It's easy if the camera moves according to the distance of the scroll, but it would look artificial and the scrolling is not smooth. I kinda stuck at scrolling acceleration and deceleration parts. Does it involve with velocity?
«
Last Edit: December 15, 2014, 09:12:14 am by kkl
»
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Camera accelerate and decelerate with scroll
«
Reply #3 on:
December 15, 2014, 02:36:08 pm »
Have you tried some simple (linear) damping?
Logged
kkl
float
Posts: 291
Re: Camera accelerate and decelerate with scroll
«
Reply #4 on:
December 16, 2014, 02:31:06 am »
I've never tried physics stuff before. Do you know any good library or tutorial that might helps?
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Camera accelerate and decelerate with scroll
«
Reply #5 on:
December 16, 2014, 07:47:11 am »
I don't think that this needs a library. If you have a target speed for each frame, just try something like
Code:
[Select]
camSpeed=(5*oldSpeed+targetSpeed)/6;
oldSpeed=camSpeed;
Then again, i'm still not entirely sure what you actually want to implement, so my suggestions might be totally missing the point...
Logged
kkl
float
Posts: 291
Re: Camera accelerate and decelerate with scroll
«
Reply #6 on:
December 17, 2014, 08:43:09 am »
Tat works like magic! Exactly wat i've been looking for.. but i still hav problem if the camera moves to the edge(i set a position limitation to left and right) and the scroll just stop right away instead of smooth scroll to edge. Do you have any idea to fix tat?
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Camera accelerate and decelerate with scroll