Add Instance resets wind movement on all old instances

I have a HISMC (Hierarchical Instanced Static Mesh Component) and there are some speedtree trees inside. I have a WindDirectionalSource in the level so the trees leaves are moving with the wind.

But every time I add a new tree to the HISMC, the wind movement get’s reset to 0 on all instances which are already inside of the HISMC. This is how it looks with one new tree per second:

(The gif is ~5 seconds long, so the reset each second is not because if the gif loop)

After 5 hours of trying out any possible setting I found what exactly is the problem.

At first I thought I made something wrong, because the bug did not occur in a new project. But the important thing is, the HISMC needs to get spawned from an Actor while the game runs! A HISMC which is created manually with “Add Component” does work. But if you create the HISMC with the “Add HISMC” Node at Event Begin Play (or at any other place while the game runs), this bug appears.

So the “real component” works, while the component which is just a variable is buggy.

I have created a repro project for you :slight_smile:

Hey Alcatraz,

I saw on the forums you managed to find where the error is occurring and wanted to add a bit of my own findings in case it helps. It is my understanding that what you are trying to do is constantly check whether or not a tree has been ‘cut’ down as well as if a tree can ‘grow’ in a given area. Based upon those returns you will spawn any given number of trees that are available to grow in that area.

I noticed the ‘Set Timer’ is what is causing your mesh to reset based on the ‘Time’ input you enter. As soon as I removed this node and/or added a ‘Clear Timer’ node the issue went away. Perhaps creating a different system of checks and balances instead of calling the ‘Update Instance Transform’ of your ‘Grow Tree’ function every second. It dawned on me that a good way to show the growing process would be through a ‘Timeline’. You did mention this was a bit buggy as a variable, so I am going to continue to play around with the project you sent to see if I can get it to update without resetting.

Cheers,

I think you are mixing stuff. In this repro project I am not checking anything regarding being cut down or anything like this. I am just updating the scale of an instance every second.

Of course if you remove the Timer which is updating the transforms the bug goes away, because then no instances are updated :stuck_out_tongue:

As I said it works with a real HISMC, so my own code (I call blueprints code…) regarding the growing and so on is not the issue.
Real Component works, while dynamically created component does not work. You get what I mean?

Hey ,

Yes, I do realize that what I was talking about was not involved in the example project you provided. I was trying to grasp the scope in which you were going to apply this blueprint because there are usually a few different ways to go about doing the same thing when it comes to game design in general. Either way, I do understand what you mean by generating these trees at runtime versus manually placing the component.

The easiest workaround for me at the moment is just to use manually created components, so I don’t need any other way to do the same thing.
Anyway, thanks for looking into this! Have you entered a bug report for this with a number like UE-XXXXX?

I just thought about that you said “It dawned on me that a good way to show the growing process would be through a ‘Timeline’”. The problem with a timeline is that it’s wasting a lot of performance. I don’t need my Trees to grow “smoothly” but once every 1 or 2 seconds is enough since they are growing reaaally slow. As long as it’s not possible to set the “tick frequency” of a timeline using it would not make sense for me.

Hey ,

There is actually already a bug entered for the ‘Wind Directional Source’ not functioning correctly with blueprints. Whether it is being called on directly or the scene is updated through a different source like the ‘Update HISMC’ with the ‘Set Timer’ node you have in place.

The bug is UE-3309, and I answered a question for another user who was experiencing issues with the ‘Wind Directional Source’ which you might find helpful as a temporary workaround. Although it does not address your issue directly, you can adapt the blueprint set up I have for your own project so the wind does not update incorrectly.

Wind Dynamic Update Broken

Regards,

Thanks, but I don’t think this is the bug I am experiencing. I am not updating wind directional source strength or speed in runtime.

The bug here is that a dynamically spawned HISMC is buggy. This is not the fault of the wind, it’s the fault of the HISMC since it works fine if I manually create the HISMC.
It might be connected to the other bug, but why are normal meshes and normal actors and manually created HISMCs working fine and only the dynamically one not working?

If you simply remove the ‘Wind Directional Source’ from the scene the issue is not apparent so there is definitely a correlation here between the updating of your mesh and the communication or, lack there of, between the ‘HISMC’ and the ‘Wind Directional Source.’ You mentioned it works fine as the component alone, so would you mind showing me how you are doing this so I can check this set up as well?

Thank you,

After removing the wind directional source there is no wind at all in the scene so of course you can’t see that the wind get’s reset every second.

Instead of using the Add HISMC Node at Event Begin Play just remove the Node, go to the components tab and click on “Add Component” and select the HISMC. Then directly reference the HISMC in the blueprint instead of using the reference from the “Add HISMC” Node.

Were you able to get it working with a manually created component?

I did manage to get the manual HISMC set up working as you mentioned. I have entered a bug for this issue UE-15049 and will also make a note of it possibly being related to the communication of the Wind Directional Source Component communication within blueprints.

Cheers,

Hey Andrew, are there any updates on this? At the moment I still use the workaround to manually add the HISMCs as a component instead of spawning them dynamically, but I really would like to get rid of this workaround.

No updates to the issue currently.