How do i get a function to return a pointer to the Custom Data Value float of an instance static mesh?

Hi SophiaWolfie,

In the Tick, move the “HISM2->MarkRenderStateDirty();” to above the “return”.

1 Like

That return was there just to show the idea.
I tried with the MarkRenderStateDirty before.
It doesnt work.
I show it here on the video:

Yes it looks like it’s the cache system not working correctly.

I really don’t think you should need a cache system though, I did some tests yesterday with my own instancing system (rdInst) and was able to go through 40 HISMs with 200 instances each, changing 3 floats per instance in 0.34ms - without any type of caching, just accessing the arrays as float*'s - or am I missing something with your configuration that would prevent that?

Also - using the WorldPositionOffset for moving the infantry is a cool approach, I animate rotation in similar ways for some things - but if you’re wanting collision on them at any stage - that will still be at their original location (you probably already gathered that).

1 Like

I did a test on 5.1 and it works ok there.

4.27 has a problem that even if you mark the hism as dirty it will not update. The inputs of the hism custom data seem to be taking new values in real-time, but the mesh will only update when you drag any custom data fields.

1 Like

This will hopefully fix that (I forgot it was 4.27)

HISM2->BuildTreeIfOutdated(true,false);

2 Likes

Switching to

HISM2->BuildTreeIfOutdated(true,true);  

Got it to work. Had to set force update to true.

Though the cache takes the full array of variables so if @SophiaWolfie wants to animate it via a specific vector the cache would have to be split into components some way.

Though it’s more of a logistics problem than a technical one :wink:

2 Likes

Thank you for helping. Its now working with the HISM2->BuildTreeIfOutdated(true, true);. Its so weird why does it need that. But okay if it works it works. Is it like a special markrenderstatedirty()? It needs it every tick to update it seems i hope its not much expensive.

For the collision im using something i called bubble collision, where i spawn collisions on the targets i move to. In my game it works since i move them in very specific occasions.

1 Like

Thank you. The HISM2->BuildTreeIfOutdated(true, true); works like a charm. I put it on the tick event and it started updating. How amazing :slightly_smiling_face:

Kind of, it’s really just a work-around to fix the MarkRenderStateDirty() not working correctly in 4.27 - it’s not needed in 5…

1 Like