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

float decoding - player entity #37

Open
lm82jyke opened this issue Jun 21, 2018 · 3 comments
Open

float decoding - player entity #37

lm82jyke opened this issue Jun 21, 2018 · 3 comments

Comments

@lm82jyke
Copy link

when printing out vectors for player entities the values seem to be decoded wrong.
while the m_vecOrigin of non-player entities are shown as mapcoordinates,
the player m_vecOrigin is not given as mapcoordinate.
here is an example with the prop-decoding-flags printed out

Entity Enters PVS: id:2, class:35, serial:781
Table: DT_CSPlayer
Field: 2, m_vecOrigin = SPROP_NOSCALESPROP_NOSCALE3295974912.000000, 3255495936.000000
Field: 3, m_vecOrigin[2] = SPROP_NOSCALE1098924032.000000
Field: 4, m_vecVelocity[0] = SPROP_NOSCALE3227493120.000000
Field: 5, m_vecVelocity[1] = SPROP_NOSCALE3279223296.000000
Field: 7, m_vecOrigin = SPROP_NOSCALESPROP_NOSCALE3295974912.000000, 3255495936.000000
Field: 8, m_vecOrigin[2] = SPROP_NOSCALE1098924032.000000
Field: 14, m_vecViewOffset[2] = 64.062561
Field: 17, m_flFOVTime = SPROP_NOSCALE1128479744.000000
Field: 20, m_angEyeAngles[0] = SPROP_NOSCALE1103372544.000000
Field: 21, m_angEyeAngles[1] = SPROP_NOSCALE1132894976.000000

Entity Enters PVS: id:155, class:126, serial:953
Table: DT_RopeKeyframe
Field: 14, m_Width = SPROP_NOSCALE1073741824.000000
Field: 16, m_vecOrigin = SPROP_COORDSPROP_COORDSPROP_COORD3622.000000, -1014.000000, 264.000000

is this a bug or am i getting something wrong
thanks in advance

@lucas-feijo
Copy link

Did you ever find a solution for this? I'm having the same problem

@trophymursky531
Copy link

I'm hitting this too, did anyone figure out why the flag is getting set wrong?

@lucas-feijo
Copy link

I did, the values are being decoded as int instead of as float. To fix it, just cast the values to int, then to binary, then back to float. Here's how I'm doing it in python, no idea if it's the best way:

import struct

def fix_position(x):
	return struct.unpack('!f',struct.pack('!I', int(x)))[0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants