Sorry that i'm so late, but if u only need w2s you can do something like this.
It's for GTA, but you can adapt it propably to every other 3D Games
Code:bool get_entity_offset_from_coords(v3& out, Entity lEntity, v3 coords) { bool ret; CEntity* pEntity; v3 dir, x, y, z; ret = false; pEntity = handle_to_ptr<CEntity>(lEntity); if(pEntity == nullptr) goto LABEL_RETURN; dir = coords - (v3) pEntity->_3dMatrix._3; x = v3(pEntity->_3dMatrix._0.x, pEntity->_3dMatrix._1.x, pEntity->_3dMatrix._2.x) * dir.x; y = v3(pEntity->_3dMatrix._0.y, pEntity->_3dMatrix._1.y, pEntity->_3dMatrix._2.y) * dir.y; z = v3(pEntity->_3dMatrix._0.z, pEntity->_3dMatrix._1.z, pEntity->_3dMatrix._2.z) * dir.z; out = x + y + z; ret = true; LABEL_RETURN: return ret; }