StatsHelix / demoinfo

A library to analyze CS:GO demos in C#
MIT License
322 stars 78 forks source link

m_Collision.m_vecMins gets incorrect values for func_hostage_rescue entities #163

Open JimmyWoodhouse opened 4 years ago

JimmyWoodhouse commented 4 years ago

Inside of DemoParser.cs:

SendTableParser.FindByName("CCSPlayerResource").OnNewEntity += (s1, newResource) => {
        newResource.Entity.FindProperty("m_hostageRescueX.000").DataRecivedDontUse += (s1, center) => ...

seems to get the X value for the center point of func_hostage_rescue entities correctly (same for Y and Z).

However,

SendTableParser.FindByName("CBaseTrigger").OnNewEntity += (s1, newResource) => {
        newResource.Entity.FindProperty("m_Collision.m_vecMins").VectorRecived += (s2, vector) => {
        trigger.Min = vector.Value;
    };

seems to provide incorrect location values in vector.Value that do not match the entity's values and they do not even seem to correspond to other entities, moreso just a random place in the void.

This seems to work perfectly fine for func_bomb_target entities, and only seems to be an issue for func_hostage_rescue entities.

Could you advise? Thanks

JimmyWoodhouse commented 4 years ago

I have also seen that DataRecivedDontUse is obsolete, however this seems to be the only one that does not throw an error and actually provides data for m_hostageRescueX.000, m_hostageRescueY_000 and so on

JimmyWoodhouse commented 4 years ago

It seems that m_Collision.m_vecMins and Maxs get Vertex values relative to the entity's origin, rather than world origin like it seems to get for bombsite entities. I've added a workaround for just using the relative coordinates to work the bounding box out from the entity's origin, but it isn't ideal