Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Smooth Orbit + Chase Camera?

Author
Message
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 17th Aug 2018 15:31
Hi! So I've been looking on the forums for a Smooth Orbit + Chase Camera & can't find one. Can someone please help a chap out?

Thanks!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Aug 2018 23:27
I would just use easing.
So you have your current point (x1,y1) and you have where you want to go (x2, y2)

nx = x1 + ((x2 - x1) * ease)
ny = y1 + ((y2 - y1) * ease)

where ease is a value between 0 and 1. So .01 would move very slowly and .9 would move very quickly


Some 2d camera tracking methods
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 17th Aug 2018 23:37
Hi, @blink0k : I was actually looking for a 3D camera.

Thanks!
Green7
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 17th Aug 2018 23:55
add z.

nx = x1 + ((x2 - x1) * ease)
ny = y1 + ((y2 - y1) * ease)
nz = z1 + ((z2 - z1) * ease)

for the rest it depends oon what you try to achieve. if you want to orbit the cam by mouse, or if it should follow the player, or both, if it should avoid obstacles etc. but i doubt you will get presented a full solution. try to figure out what you want to achieve, and what components you need for the solution. then try to solve the components one by one.
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 18th Aug 2018 01:14
Yea, I was looking for smooth orbit cam.

Thanks!
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 18th Aug 2018 01:47
Just to clear up confusion, ease is essentially linear interpolation, which is also this:




I think they are functionally equivalent.
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 18th Aug 2018 02:10
Where do I define the variable, "ease" ?
Green7
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 18th Aug 2018 09:26
you may write it where ease stands, as you may want different values for different directions. go ahead and try.
Icerion
6
Years of Service
User Offline
Joined: 3rd Aug 2018
Location:
Posted: 18th Aug 2018 21:59
I meant like what do I substitute "ease" for?

Thanks!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Aug 2018 01:12 Edited at: 19th Aug 2018 01:12
ease as float
ease = 0.5 // Or any value between 0.01 and 0.99

make sure your x/y/z and/or angle values are floats as well
try it

Login to post a reply

Server time is: 2024-11-23 04:59:12
Your offset time is: 2024-11-23 04:59:12