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 / [SOLVED] Moving object towards camera

Author
Message
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 21st Nov 2019 23:33
I need to move (and rotate) and object in x/y/z space towards the camera. Any ideas?
Dutch

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Nov 2019 00:16 Edited at: 22nd Nov 2019 00:19
Use SetObjectLookAt() to rotate the object towards the camera
Then MoveObjectLocalZ() to move it towards the camera
I'm not sure how you want to rotate it but you could use RotatObjectLocalZ() to rotate it around the axis that points toward the camera
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 22nd Nov 2019 00:27
I have this, but it is way to abrupt

for i=1 to 160
SetObjectLookAt(_sprite,0,200,0,0)
SetCameraLookAt(1,getobjectx(_sprite),getobjecty(_sprite),getobjectz(_sprite),0)
MoveObjectLocalZ(_sprite,1)
sync()
next
Dutch
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 22nd Nov 2019 00:30
I'd like to slowly turn the camera towards the object, that also slowly turns towards the camera whilst moving towards it.

It would be handy to now the distance from one object to another...
Dutch
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Nov 2019 00:46 Edited at: 22nd Nov 2019 01:11
This post has been marked by the post author as the answer.
Use easing (Distance function included)
Camera will flip if crossing an axis



Camera and object movement (Positions object withing 9-10 units of camera)
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 22nd Nov 2019 08:51
Brilliant, I'm getting the hang of it now again. It's been a while and too much Dark Basic is still in my head where some stuff was slightly easier to do (so my memory says, probably not)
Dutch

Login to post a reply

Server time is: 2024-04-20 09:17:36
Your offset time is: 2024-04-20 09:17:36