Download

Instanced Static Meshes with Look At functionality

Having problem getting proper orientation (rotation) of instanced static meshes.
Could anyone possibly point me to a simply Blueprint example of Instanced Static meshes with some type of ‘Look At’ functionality?

You get the instance actor, and call GetInstanceTransform() / UpdateInstanceTransform() on it. There’s also GetInstanceCount() to know how many instances there are.
Note the documentation for the Mark Render State Dirty boolean – you must set this to true.
If I remember correctly, the New Instance Transform value is in coordinates relative to the overall instanced static mesh actor, so if you have a world space transform, you want to multiply the world transform you want for the instance, by the inverse of the actor transform, before adding it.

1 Like

Thanks!!
I already have a reference to the Instance Transform and know I only need to update the Z or Yaw rotation for each instance.
Can I not simply use the GetWorldLocation and Find Look At Rotation nodes?

Having a problem defining the Target though.
I am guessing Scene Component is not compatible with Instanced Static Mesh?

Calling “Get World Location” on the “Default Scene Root” gets the location of the scene root, which is largely unrelated to what you want to do. It is likely the position of the actor itself, not of each instance.

To update a transform, you will want to use Break Transform and Make Transform.

Scene Components and Instanced Static Meshes are fine to use together if you need to add components, but each instance is not a scene component in itself. They are a much more light-weight thing (instance) – that being the whole reason they exist.

1 Like

Thanks for the awesome help!
Not sure why but the attached is finally working!

One other thing I need to accomplish is the setting of the Mark Render State Dirty to true after the last static mesh is instanced.
The only way I can think of is defining a Boolean and then somehow using the Completed exec on my ForEachLoop to set this Boolean but there doesn’t seem to be a proper generic Set Boolean option.

Mark Render State Dirty is not a property, it’s a function argument.

It’s OK to set it to true for each instance you define/update.