Instance static mesh you can move?

I have been using instance static mesh to do some rendering for a flock of fish simulation. It struck me today that one of the bugs I’m having (the instances go away when you move the actor), is that its STATIC mesh :slight_smile: doh!!!

So, erm… what is the best type of object to use to render a bunch of instances of meshes that can be moved around?


See this tutorial. I think this help you

Not sure that helps, he’s just spawning a bunch of actors there, I want to use instanced meshes (they are all the same fish mesh, just in different positions). I also don’t want to have the overhead of an actor per fish (no need).

Thinking about it, the STATIC part of instancestaticmesh is just that the instances aren’t skeletal meshes right? So maybe I’m not thinking wrongly and maybe this is a bug. I guess I’ll post a message on answerhub.

We’re looking for the same thing. I posted on answerhub here - @zoombapup did you ever get a response?

Hey zoombapup -

A Static Mesh can move at runtime if its mobility is set to Movable. Normally when a Static Mesh is placed in the engine at runtime the engine will automatically set its mobility to Movable. A Skeletal Mesh would only be needed if you wanted to have say the fish’s tail swish back and forth, so internal movement to the mesh not movement in the larger world. You should be able to use a for loop and an instance count to get the individual instances and pass it through an Update Instance Transform and reset the location each time the update is called. Add a timeline in the setup and you can achieve a smooth transition from point a (Transform A) to point b (Transform B). The Transform information is the only part of a Instance Static Mesh that can be altered per instance.

Thank You

@eric ketchum hello sir, how about an instanced version for flipbook?
i know there’s one for instanced sprite… but i was wondering if there’s one for flipbooks…
non moving and moving flipbooks

You can move around instances of a UInstancedStaticMeshComponent. Given a UInstancedStaticMeshComponent you can access and modify the transforms (FMatrix) of the instances like this:

UInstancedStaticMeshComponent* ISM;

// Access an instance's transform
FMatrix T = ISM->PerInstanceSMData[SomeIndex].Transform;

// Modify an instance's transform
ISM->PerInstanceSMData[SomeIndex].Transform = FTransform::Identity.ToMatrixNoScale();

Then you just need to tell the render thread that instance data has changed:


I guess your flocks don’t have collision but generally if your ISM does have collision, notify the navigation system too: