How to attach array of static meshes to rotating actor?

So, the gist here is I’m trying to create a generic, easy to modify means of having a ton of slowly rotating meshes. I attempted to do this solution with a RotatingMovement component but those don’t work with slowly rotating objects. So I was given an alternative solution:

Which works fine for a single actor but I’m trying to scale this up and I’m encountering a ton of problems. For this post specifically, I need to be able have multiple meshes all linked to a single rotating source (Rotating in tandem) whilst being able to be individually adjustable (Keeping their relative position to the source).


In order for this to work with my existing movement system, I can’t make all these meshes into a single actor. And I’d really rather not have to add this blueprint logic to each and every mesh and try to sync their movements. Not to mention avoid generating a ton of blueprints that do pretty much the same thing, but with different meshes.

I was hoping I could parent/attach static meshes from an array to a rotating cylinder I could then hide/make invisible, but I’ve so far not found a good way to do that.

I am getting the impression I’m going about this the wrong way. Any help or insight into this would be appreciated.

Hi) So, you mean you want to have a separate axis of rotation with various objects attached to it?

Howdy!

Yes? I’m not sure I fully understand what you mean but if you consider my source cylinder a representation of an axis of rotation, then I think the answer is yes.

Another way to look at it is that I have a ‘sun’ with a bunch of ‘planets’ and I need a way to attach each planet to the sun but they’d all follow the same axis of rotation while keeping their relative positions, so if it simplifies the process the axis itself needn’t have a static mesh associated with it. In fact an invisible line or abstract transform might be better overall. I just thought we needed an object to assign rotation and adjust position in-editor.

If I understood you correctly, you have a main object that rotates, and you need to attach other objects to it that have their own rotation, but are still dependent on the central one?

Yes, I think so, they’d all rotate around the center object, which itself is rotating, matching speed and direction. So they’d “act” like one rotating object.

But just to make 100% certain we’re on the same page, let me provide a concrete example to illustrate. I’ve got this actor here:

Which rotates around the green arrow.

Now, I need to make each of those protrusions its own actor/mesh instead of it being one big mesh, but I’d still like it to rotate as if it were one. And be able to reposition each individual bit, of course.

I think I have found one possible solution, although it’s not ideal.

I can make each mesh a “Rotatable” BP, and set its mesh to what I want and set its parent to the source cylinder. Then on tic have its rotation set to its parent rotation.

This still seems overly complex to me, and changing the static mesh doesn’t seem to update the BP’s visuals in-editor but that’s a separate issue I assume.

It also doesn’t maintain the mesh’s editor rotation because it’s being set on begin play. So clearly that’s not right.

I just tried writing some code based on what you said, and it seems to work.
Try doing the following:

Create two Blueprints — one for the central axis, and another for the rotating object.
Make it so that the central axis rotates in world (global) space, and the object rotates in local space.
Then simply attach the rotating object to the central axis.


I tried to implement and tinker with this but to no avail.

There might have been a miscommunication, I blame my “Sun/Planet” analogy myself. I’m not too great at explaining things :c

But I also think I might have found another solution.

The “Source” BP:

With this solution, the BP rotating around the source actually doesn’t contain any blueprints, just a constructor script to change the static mesh. So it’s effectively just a static mesh that gets treated as a blueprint.

I also went ahead and removed the mesh from the source as well. I added an arrow as a visual aid instead.

Not as easy as just adding static meshes to an array but it’s close!

1 Like

I used a different blueprint because it makes the feature more flexible to customize—you can add animations for each object, damage, or lighting if needed. But if you’re fine with just static objects, then your implementation works perfectly well :slightly_smiling_face:
Another option is to use Instanced Static Mesh or Hierarchical Instanced Static Mesh.

1 Like

I’ll have to keep it in mind then after I start implementing this into proper levels. This has been an enlightening learning experience. Thanks again for all your help!

1 Like

You’re welcome)
Best of luck with your project!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.