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.

AppGameKit Classic Chat / Align 3D Object to x,y,z point gradually?

Author
Message
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Dec 2018 18:21
Hi Guys

Think "SetObjectLookAt()" but instead of immediately pointing at the co-ords I want my object to gradually turn towards the point by a set amount, I have absolutely no idea where to start, any pointers?
puzzler2018
User Banned
Posted: 14th Dec 2018 18:33
Instead of using that command

Maybe perhaps get the "look at" object position with

X# = getobjectx
Y# = getobjecty
Z# = getobjectz

and the cameras angle

camx# = getobjectanglex
camy# = getobjectangley
camz# = getobjectanglez

and use AtanFull to get a new angle or maybe lerp these together by a .1 or something


Unless there is an amazing command that does it all..
Thats how i would try it, putting it into code could be a little challenge, so i will have a go later
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 14th Dec 2018 18:37
How about the use of a Lerp function?

chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Dec 2018 19:08 Edited at: 15th Dec 2018 11:58
Oops! I misunderstood the question
I'm not a grumpy grandpa
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Dec 2018 20:38
I think you could do that with a tween but easing will work.
So you have two points. Where you are and where you want to be

are.x, are.y, are.z
be.x, be.y, be.z

are.x = are.x + (be.x - are.x) * ease
are.y = are.y + (be.y - are.y) * ease
are.z = are.z + (be.z - are.z) * ease

ease if the amount of easing you want so 1 will move there immediately, 0.1=fairly slowly .9=quickly

If you have a look in the code i posted for the kart thing it does that with the camera.

Login to post a reply

Server time is: 2024-04-23 13:03:40
Your offset time is: 2024-04-23 13:03:40