Skip to content

player rotation sometimes 0? #4

@will-emmerson

Description

@will-emmerson

I have a strange problem in that player.rotation doesn't seem to be updating. I have some simple code in the client which moves a bit and prints out x,y and rot:

            logging.info(f'THREAD x:{client.player.posX} y:{client.player.posY} rot:{client.player.rotation}')
            client.key('RIGHT', True)
            client.key('UP', True)
            self.wait(1)
            client.key('RIGHT', False)
            client.key('UP', False)

And I also print out x,y and rot on update:

@client.on('PLAYER_UPDATE')
def on_update(client, msg):
    if msg.id == client.player_id:
        logging.info(f'UPDATE x:{msg.posX} y:{msg.posY} rot:{msg.rot}')

But for some reason player.rotation is quite often 0 even when message.rot isn't:

25.298 INFO     START BOT
25.910 INFO     UPDATE x:-995.3671875 y:-3114.568359375 rot:0.0
26.302 INFO     THREAD x:-995.3671875 y:-3114.568359375 rot:0.0
26.324 INFO     UPDATE x:-995.3671875 y:-3114.568359375 rot:0.0
26.472 INFO     UPDATE x:-995.3671875 y:-3114.568359375 rot:0.00030517578125
27.328 INFO     UPDATE x:-840.345703125 y:-3139.748046875 rot:3.91357421875
27.415 INFO     UPDATE x:-840.33984375 y:-3139.736328125 rot:3.91357421875
28.307 INFO     THREAD x:-840.33984375 y:-3139.736328125 rot:0      <-------
28.329 INFO     UPDATE x:-782.83203125 y:-3040.529296875 rot:3.91357421875
28.372 INFO     UPDATE x:-782.830078125 y:-3040.52734375 rot:3.91387939453125
29.330 INFO     UPDATE x:-899.068359375 y:-3108.3828125 rot:1.53350830078125
29.484 INFO     UPDATE x:-899.0625 y:-3108.400390625 rot:1.53350830078125
30.312 INFO     THREAD x:-899.0625 y:-3108.400390625 rot:0      <-------
30.334 INFO     UPDATE x:-869.271484375 y:-3215.416015625 rot:1.53350830078125
30.334 INFO     UPDATE x:-869.26953125 y:-3215.419921875 rot:1.533966064453125
30.685 INFO     DEAD

UPDATE is coming from update function and THREAD is coming from the thread. You can see that at 28.307 the rot is 0 even though a second before it was 3.9135. It happens again at 30.312.

Am I just being stupid?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions