Skip to content

wrongness needs to be restricted to minus pi and plus pi #8

Description

@ricklindstrom

Because the angle_to is between minus pi and plus pi and
Because the rotation is between minus pi and plus pi
The wrongness is between minus 2 pi and plus 2 pi
wrongness = client.player.angle_to(player) - client.player.rotation

The problem with this is, for example, if it calculates -1.5 pi it will make a big left turn left when it should actually do a small right turn of 0.5 pi.

My kill rate had a nice improvement after I added this:

    if (wrongness < -math.pi): wrongness = wrongness + (2.0 * math.pi)
    if (wrongness > math.pi):  wrongness = wrongness - (2.0 * math.pi)

p.s. - Thanks for this project. I am enjoying it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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