[Boats] Fix x/y offsets from client to reflect EQ x/y instead of boat heading… #1296
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the end of 2019 I pushed a [PR] ( with @Uleat ) which corrected an issue where clients did not properly see other clients that were on a boat. This was because the x/y sent by the client is an offset from the center of the boat they are on, when the client is onboard. We had no code for this, so the moment a client went onto a boat they warped off to close to 0,0 on other client's screens.
I've come to learn, while trying to get cross zone ports from boat to boat working, that the client x,y is also an x,y offset which is based on the boat's heading. So if the boat has a heading of 0, the x,y offsets are correct in EQ map coordinates, but if the boat is at heading of 128 for example, the x,y sent by the client need to be rotated about the boat's origin to get correct x,y offsets in the EQ map world.
To complicate matters, simple rotation around the boat origin math needed to be altered due to the fact that the EQ X axis is negative to the right, while most axis systems are x positive to the right.
I believe this PR will:
The PR also modifies the boat/zomm code slightly to share a variable to clean up that code a little.