HungryProton / scatter

Godot engine addon to randomly fill an area with props or other scenes
MIT License
2.07k stars 94 forks source link

Question: Attatch to moving object? #183

Open Slluxx opened 8 months ago

Slluxx commented 8 months ago

I am really sorry if this question has been asked or documented somewhere.

I would just like to know if its possible to attatch it to a moving node so the generation always happens in a fixed region around whatever it is attached to (for example a player). It would be awesome to generate grass in this way so that the generated blades stay at the same position in global space. If its then possible to have a list or flags attatched to nodes to white or blacklist generation on certain objects, it would be truly amazing. I think this could be extended to use a seed to generate the same grass at the same position, without saving any spawn positions.

I know there are a lot of limitations on GPU instancing so please forgive me if i am totally mistaken.

This is an awesome addon nonetheless and i am glad it exists!

florianvazelle commented 8 months ago

I don't think it's possible, you can define a seed but it's not based on the position of the scatter node.
The scatter node inherits from a Node3D, so you can attach it to another moving node, you have to play with the "force update" setting or other parameters, but it's not very efficient.

Actually, you can easily create a large scatter node and apply a visibility range to the scatter item, to make the element appear only around the camera.

Slluxx commented 8 months ago

Maybe, yeah. I am just slightly confused by a few things. For example i thought that gpu instanced objects can only be culled if none of the objects are on screen anymore. However i am getting better fps the the less grass i have on screen (from the same scatter node). Am i just misstaken? Is the gpu instancing working? And how could i check that myself?