GitHub Documentation

Re-triggering filter on condition changes



  • Hello!
    I have a situation where I'm using filters to hide certain things (in my specific case, some map-related data) from a player based on a parameter in the player's state. When that parameter changes, I need to get the filters to adjust - and change the state that is available to the player - but it doesn't happen automatically. Is there a way to re-trigger these filters?

    Thanks,

    Lee-Orr


  • administrator

    Hi @lee-orr, that is a really good question, and something we should think about for improvement in the future.

    To allow "filtering by distance", I've used this piece of code on the pixijs demo:

    entity['$changes'].touch(0); // 0 means fieldIndex: 0
    

    Instances that should be re-evaluated need to be flagged as "dirty" by using this workaround.

    I hope this helps! Cheers!



  • Thanks, this works!
    My client now receives new data it gains access to. It's not significant in my case (at least not yet), but the client doesn't lose access to data it had access to before - though doesn't seem to get updates to it. My hope is that if it re-gains access to that data, it'll update again, but I can't test that yet... If I have issues there I'll post again.


 

© 2020 Endel Dreyer