CheckBoxInPVS / CheckOriginInPVS

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
InvisibleSoldiers
Senior Member
Posts: 114
Joined: Fri Mar 15, 2019 6:08 am

CheckBoxInPVS / CheckOriginInPVS

Postby InvisibleSoldiers » Fri Jan 03, 2020 6:14 pm

Source.Python:

Syntax: Select all

.def("check_origin_in_pvs",
&IVEngineServer::CheckOriginInPVS,
"Check whether the specified origin is inside the PVS",
args("org", "checkpvs", "checkpvssize")
)

.def("check_box_in_pvs",
&IVEngineServer::CheckBoxInPVS,
"Checks whether the specified worldspace bounding box is inside the specified PVS",
args("mins", "maxs", "checkpvs", "checkpvssize")
)

Source-SDK:

Syntax: Select all

// Check whether the specified origin is inside the specified PVS
virtual bool CheckOriginInPVS( const Vector &org, const unsigned char *checkpvs, int checkpvssize ) = 0;
// Check whether the specified worldspace bounding box is inside the specified PVS
virtual bool CheckBoxInPVS( const Vector &mins, const Vector &maxs, const unsigned char *checkpvs, int checkpvssize ) = 0;


I retrivied pvs_info of entity through player.edict.networkable.pvs_info

Syntax: Select all

//-----------------------------------------------------------------------------
// Stores information necessary to perform PVS testing.
//-----------------------------------------------------------------------------
struct PVSInfo_t
{
// headnode for the entity's bounding box
short m_nHeadNode;

// number of clusters or -1 if too many
short m_nClusterCount;

// cluster indices
unsigned short *m_pClusters;

// For dynamic "area portals"
short m_nAreaNum;
short m_nAreaNum2;

// current position
float m_vCenter[3];

Also there is error: TypeError: No Python class registered for C++ class PVSInfo_t
But that's not the point.

CheckOriginInPVS or CheckBoxInPVS want vector(s), I have this, but there are also checkpvs which should be char pointer and not PVSInfo_t pointer, so I have to translate pvs_info to the array. How?

Found something related to it but I still don't know what to do exactly. Do you have any thoughts :confused: ?
Maybe I need just retrieve a origin from landmark :confused: and get a cluster etc.., or pvs_info still better.
pvs_info stores many cluster indices, and here used only one cluster index.

Syntax: Select all

// look for a landmark entity		
CBaseEntity *pLandmark = FindLandmark( m_szLandmarkName );

if ( !pLandmark )
return false;

// Check to make sure it's also in the PVS of landmark
byte pvs[MAX_MAP_CLUSTERS/8];
int clusterIndex = engine->GetClusterForOrigin( pLandmark->GetAbsOrigin() );
engine->GetPVSForCluster( clusterIndex, sizeof(pvs), pvs );
Vector vecSurroundMins, vecSurroundMaxs;
pEntity->CollisionProp()->WorldSpaceSurroundingBounds( &vecSurroundMins, &vecSurroundMaxs );

return engine->CheckBoxInPVS( vecSurroundMins, vecSurroundMaxs, pvs, sizeof( pvs ) );

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 3 guests