Jump to content

HOW TO Send updated player facing direction to server


nolanri

Recommended Posts

10 minutes ago, Butter Bot said:

Don't see it being used anywhere in the game's code or within Lua, so I assume there's a different function that is actually transmitted to the server in IsoPlayer's update(). Maybe setDir(IsoDirections directions).

 

Oh first off, my mistake i am using gameCharacter:setAngle(vector) to rotate the player. 

setDir() only has the 8 angle options such as North nothwest etc.  And since you can see other players in MP turn gradually as they aim. Im sure thats not it. 

Link to comment
Share on other sites

Ah, looks like the server checks these variables to determine the facing angle:

        player.setDir(dir);
        player.angle.set(player.dir.ToVector());


These, I think, are sent to the server with IsoPlayer.update(); specifically, the GameClient.instance.sendPlayer(this) function.

 

Not sure where it's getting around the 8 directions, though.

Link to comment
Share on other sites

16 minutes ago, Butter Bot said:

Ah, looks like the server checks these variables to determine the facing angle:

        player.setDir(dir);
        player.angle.set(player.dir.ToVector());


These, I think, are sent to the server with IsoPlayer.update(); specifically, the GameClient.instance.sendPlayer(this) function.

soo can i just force sendPlayer(getPlayer()); through game cleint?

 

how do i call that in LUA?

 

getGameClient():sendPlayer(getPlayer());
getGameClient():sendPlayer(getPlayer());

GameClient.instance():sendPlayer(getPlayer());

GameClient.instance():sendPlayer(getPlayer());

 

?

Link to comment
Share on other sites

temp.png

 

if(getGameClient()) then getGameClient():sendPlayer(getPlayer()); end
hmm but this is on single player. maybe it would still work in MP?  but how to make it at least NOT error in sp if that is the case

Edited by nolanri
Link to comment
Share on other sites

well took me absolutely forever  to figure this out but for the record:

IsoPlayer:setAngle() must be a method being phased out or something because even though setting it does change the direction your local player faces, whatever values it is setting NEVER get updated to the server in MP.  Simply put it is not used in MP. 

I even made a servercmd that sends clientcommands to clinets to try and use setAngle() to turn all the other players in each persons client side.  but this method only works on localplayer. 

 

taking the vector from getAngle() after setting it and putting it into :

player:DirectionFromVector(vector)

then it started syncing the facing direction in MP
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...