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 Studio Chat / Camera and object movment Problem?

Author
Message
Zubby1970
11
Years of Service
User Offline
Joined: 22nd May 2008
Location:
Posted: 2nd Sep 2019 03:51
So I have a level editor or and object placement utility I am creating, the issue I have is if I add an object and can then move it with the cursor keys for fine editing. but if I move the camera to say the side view then the keys feel like they have swapped, I know this is not the case, the object is going in the direction I told it to. my question is? is there a command or system of command so the object will always be moving forward if I press the up key no matter what direction the camera is facing.? I hope I have explained my self correctly I know what I mean but that doesn't help me lol.
There can only be one
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Sep 2019 05:45
If by moving forward you mean moving along the Z axis then maybe you could use MoveObjectLocalZ()
Zubby1970
11
Years of Service
User Offline
Joined: 22nd May 2008
Location:
Posted: 3rd Sep 2019 22:57 Edited at: 3rd Sep 2019 23:23
no this will move in that direction regardless of the camera angle,
There can only be one
SFSW
16
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 3rd Sep 2019 23:34
Not sure I understand what it is exactly you are asking to do. But if blinkok's suggestion isn't what you are after, then are you trying to move the camera in one consistent global direction regardless of local angles? If so, you'll simply need to align your level editor's default orientation with the global X, Y, and Z coordinate system, then view from overhead above on positive Y to look down on the world you are editing. Or use whatever global alignment configuration you want to use, but for a level editor, you generally want to keep things consistent with how AGKS is going to place things internally to begin with. From there, you can do this to consistently move an object or camera 'up' on Z regardless of what direction it is facing with its local angles:

For an object (where 'Movement#' is the distance you want to move it)
SetObjectPosition(GetObjectX(ObjNum),GetObjectY(ObjNum),GetObjectZ(ObjNum)+Movement#)

For the camera:
SetCameraPosition(1,GetCameraX(1),GetCameraY(1),GetCameraZ(1)+Movement#)

You can do this with any global direction you want to.
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
hendron
3
Years of Service
Recently Online
Joined: 20th Dec 2015
Location:
Posted: 4th Sep 2019 03:31 Edited at: 4th Sep 2019 15:28
You could try something like this:

EDIT: Made a mistake in my code. Updated.

Login to post a reply

Server time is: 2019-09-22 18:25:50
Your offset time is: 2019-09-22 18:25:50