• movement with coordinates
    5 replies, posted
hello everyone, does anyone of you have an idea how i could solve this issue ? i receive X and Y coordinates through a UDP port, now what i want to do is to move the player according to those coordinates (doesnt matter if relativ or global).. the only way i succeeded to get moving is by running the console command "setpos", the problem there is that it doesnt affect the z coordinates, so i just run through stairs/ramps instead of going up.. thats kind of logical cause it just ports me to the given x y coords an z stays 0 .. i tryd it with SetVelocity and/or SetForwardSpeed but i always get nil values.. and i didnt find anything how to use the CMoveData properly.. can one of you maybe explain me either how CMoveData works or lead me into any direction? as you see im a real newb.. btw im running the script in /lua/autorun/client/ thanks numu and here the code i got so far: [CODE] require("oosocks") local move_con = OOSock(IPPROTO_UDP); move_con:SetCallback(function(socket, callType, callId, err, data, peer, peerPort) if(callType == SCKCALL_BIND && err == SCKERR_OK) then print("Bound."); move_con:ReceiveDatagram(); end if(callType == SCKCALL_REC_DATAGRAM && err == SCKERR_OK) then local stringedm = tostring(data) local StringNodes = string.Explode(" ", stringedm) x = string.sub(StringNodes[1], 1, 3) y = string.sub(StringNodes[2], 1, 3) r = string.sub(StringNodes[3], 1, 3) SetPos( x, y, r ) move_con:ReceiveDatagram(); end end); function SetPos( x, y, r ) RunConsoleCommand("setpos", x, y) RunConsoleCommand("setang", 0, r) return true end move_con:Bind("localhost", 7777); [/CODE]
here s a little video about what im doing [video=youtube;Bp2Figk5GAo]http://www.youtube.com/watch?v=Bp2Figk5GAo[/video] it accually DOES work to walk the ramp just by using Setpos... but if you move a little too fast it doesnt.. id really appreciate anyhelp i can get, im trying to build a VR room with headtracking etc...
Use the Move hooks instead, to override the movement in general.
[QUOTE=Wizard of Ass;36960307]Use the Move hooks instead, to override the movement in general.[/QUOTE] hey, thanks for the reply could you just write a little example how it should work ? as i said, i always got nil values, also with the move hook.. the only reference i find on those hooks is this: [HTML]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index0908.html[/HTML] and this really didnt get me anywhere.. im trying since days cheers numu
If you wanted, you could probably do this 100% client side with a CreateMove hook. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexee60.html[/url]
[QUOTE=BlackAwps;36966881]If you wanted, you could probably do this 100% client side with a CreateMove hook. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexee60.html[/url][/QUOTE] yay! thanks a lot ! thats exactly what i needed! it moves!
Sorry, you need to Log In to post a reply to this thread.