Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunk Coords is misleading name or has wrong address #41

Open
Eisenwave opened this issue Feb 1, 2023 · 1 comment
Open

Chunk Coords is misleading name or has wrong address #41

Eisenwave opened this issue Feb 1, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@Eisenwave
Copy link

The current address for chunk coords [[[[[[[WorldChrMan]+10EF8]+0*10]+190]+68]+A8]+18]+D0..D8 aren't actually chunk coords but some sort of player focus point.

They appear to be set to the local coordinates of the lock-on target when the player locks onto something.

@tremwil
Copy link
Contributor

tremwil commented Feb 2, 2023

Yeah, the name is misleading. A proper name would be "local coordinates origin" or "physics coordinates origin", cause that's what they're used for. Here is what I recall working with them; it was quite a long time ago so if you find out any of this is wrong after testing please tell me:

They are the origin of the player's local coordinate frame expressed in the last loaded map's frame. The game periodically modifies them to minimize floating point error in physics calculations, which use the local coordinates. In particular, when there is no lock-on target, the game tries to keep the absolute value of each component of the local coordinates below 32. When there is a lock-on target, it uses the position of the locked-on entity (at the time of lock-on) as the origin.

@inuNorii inuNorii added the help wanted Extra attention is needed label Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants