Hey everyone! So I’ve been making some games for quite some time and I wanted it to be visually appealing. And I wanted to make the trees have a wind movement script that basically makes it rotate in random directions slowly to add a wind effect. The script isn’t the issue but I wanted to ask a question regarding performance before I implement it in the game. So the game already has a very big number of trees, so if I added the movement script to the tree leaves, will it be more laggy than it already was before adding the script or will it not affect the performance at all?
Well they are moving trees and static trees don’t move, but moving trees have moving parts, So it depends on what is being moved, It could affect performance
I dont think moving parts affects to your performance too much, i never heard smth like that.
From a technical point of view, having a lot of moving parts could worsen performance. If you would like to test this, you can create 10k parts in Studio, make them all anchored, click Play and see what happens. Then, set them all to Unanchored and click Play and see what happens. What should happen (unless im being stupid and dumb) is when the parts are falling, you will experience lag spikes (unless your device is extremely state of the art) and the lag will die down and your FPS will rise after the parts stop moving. Performance can also be affected by how many scripts are running at once.
Also something to make your trees more visually appealing would be to add leave particles that fall down
I mean yeah, iterating vs not iterating over hundreds of trees every frame will obviously show a pretty big difference. If you unanchor all their parts and weld them to some anchored root part, you’ll get about as close as possible to a good ballance between fidelity and performance. Also, running a loop over all trees will be much more efficient then placing an individual script into each tree.