public void UpdateHomeZone( PCZSceneNode pczsn, bool allowBackTouches )
{
// Skip if root PCZoneTree has been destroyed (shutdown conditions)
if ( null == defaultZone )
{
return;
}
PCZone startzone;
PCZone newHomeZone;
// start with current home zone of the node
startzone = pczsn.HomeZone;
if ( null != startzone )
{
if ( !pczsn.IsAnchored )
{
newHomeZone = startzone.UpdateNodeHomeZone( pczsn, false );
}
else
{
newHomeZone = startzone;
}
if ( newHomeZone != startzone )
{
// add the node to the home zone
newHomeZone.AddNode( pczsn );
}
}
else
{
// the node hasn't had it's home zone set yet, so do our best to
// find the home zone using volume testing.
Vector3 nodeCenter = pczsn.DerivedPosition;
PCZone bestZone = FindZoneForPoint( nodeCenter );
// set the best zone as the node's home zone
pczsn.HomeZone = bestZone;
// add the node to the zone
bestZone.AddNode( pczsn );
}
return;
}