Scripts / Update on separate controlled movement of Player/Camera

Author
Message
GoDevils
9
Years of Service
User Offline
Joined: 24th Sep 2014
Location: Arizona USA
Posted: 25th Jul 2016 21:45
I've been gone for a while on another project, but I kept up a little over the past few months.

I've been waiting for a set of LUA commands that allow the camera/player to be controlled like any other object.
Forward/back/up/down/turn right and left, as well as rotation for the other two axis.

also, the ability to continue moving forward with the ability to turn and look side to side without turning.

I have used the Transport To command which allows for movement (forward/back/left/right/up/down), but without the rotations, which falls short of what I want.

A few months back I saw a video of a submarine game that appeared to fulfill most of my requirements.

Can anyone steer me in the right direction (pun intended) for accomplishing my goals, or is it till too soon?

Thanks
"THERE IS NO SPOON"

AMD 6300 6 core 3.5 ghz, Windows 8.1, 8GB ram, GTX 650 2GB ram
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Jul 2016 23:43
i would set an invisible object (or a custom character if third person) that isn't attached to the camera (but will act as a player for angle purposes - so you can check the player's facing while turning the camera and not affecting it)

so...
you can build your own movement by checking
if g_KeyPressW == 1 then

elseif g_KeyPressS == 1 then
etc

then use
SetFreezePosition(x,y,z)
SetFreezeAngle(ax,ay,az)
then
TransportToFreezePosition()
and
TransportToFreezePositionOnly()
to move to the desired position
but you will also need to use cos and sin to calculate the new position relative to the angle (this is where the dummy character comes in as checking g_PlayerAngY will return the camera angle and you said you want to be able to turn the camera independently)
SetFreezePosition(g_PlayerPosX+amount*(math.cos(g_Entity[dummy_char]['angley'])),g_PlayerPosY,g_PlayerPosZ+amount*(math.sin(g_Entity[dummy_char]['angley'])))
(should be enough to get you started)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-05-04 03:16:56
Your offset time is: 2024-05-04 03:16:56