Jump to content

[SOLVED] Do scripts run on occluded entities?


photo

Recommended Posts

Posted

I am creating a world with 1000s of moving entities. Are scripts running on non visible entities by default?

Posted

Hi Christian!

 

Sorry for late reply. It depends on how you're using your scripts & nodes. Generally, there's no 'scripts on objects' feature, you usually write your code in world/system scripts.

 

You can find additional info about where to put your code here: https://developer.unigine.com/en/docs/1.0/code/execution_sequence/code_update

 

A few words about the most common use cases:

1) Custom logic in world/editor script: calls update function every frame, so you can do whatever you want (grabe & update every node in a world, skip nodes by criteria, etc.). It's really up tp you how

2) WorldExpression node attached to other node: calls its script every frame within expression's bounds (size parameter).

 

Feel free to ask more! :)

Posted

Hi

I guess what I mean then is, how can I tell if an object is being occluded? isVisible() ?

Thanks

Posted

Hi Christian!

 

There is no callbacks like 'onBecameVisible/onBecameInvisible', you have to handle it by yourself. It's simple, just check if object is within camera frustum.

×
×
  • Create New...