Download

Moving static meshes in a blueprint

Hello all,

I’ve been trying to figure out a way to place a large abundance of fish into a map I’m creating. Right now, I have each one as an individual actor. When I place 1000 of them, however, my frames drop from 60 to 30.

I have an idea that instead of using each fish as an individual actor, I would create one actor that moves all the fish around the map, reading and setting their locations as a global fish controller. More advanced AI setup could also be done here eventually.

The primary thing blocking me from doing this, however, is I’m not sure how to move the fish static meshes around from a blueprint.

Is there any ‘Get all Static Meshes of Type,’ sort of like ‘Get All Actors of Class’ function I could call that would allow me to access all of the static meshes of type ‘Fish_Mackerel,’ for instance, on my map?

You can save references of the fish with GetAllActorsOfClass and save the resulting array as variable. I’d do it on BeginPlay event so you dont need to manually call it. Then you can set RelativeLocation to each static mesh in your way of choosing. Relative location is same as GetActorLocation + location of the static mesh. SetWorldLocation also works. That is the direct location in world grid