Rotate a bone using blueprints / import fbx and keep pivot

Hi,

I am trying to figure out a way to make a simple animation driven by blueprints.

I have a compass model and the dial should always rotates to point north. The blueprint code to do that is already set up and working with an arrow component.

Now I want to make this happen with the actual compass model.

I am porting this project from Unity. In Unity I exported the FBX and inside it was each subobject with it’s own pivot as set up in Maya. It seems I cannot use this same workflow in unreal because a static mesh actor cannot contain subobjects? The pivot of each subobject is essential for correct rotations.

I tried importing the fbx without the mesh combined, but each actor then does not maintain it’s own custom pivot, they all take pivot of the group object in Maya.

It seems the only option then is to setup a rig. So I’ve done that, thinking I could just get the rotation of the bones and plug that into the script. But it seems I can’t access bone properties in blueprints? Will I have to setup variables in blueprints and use these to drive behavior over in anim graph?

I am just trying to keep this as simple as possible since I am new to coding and unreal. Any advice is appreciated. I can figure out the details, but if somebody can point me towards the best workflow that would be a big help. THanks.

For reference, here is the model. Note that the selected subobject (the rotatinng dial) has its pivot set in it’s center. Thus, the static mesh could rotate by itself from there, but I also have the associated bone in the same spot.

Just use a material.

The skeletal mesh is OK because of the “open close” action on it that you have to animate. But there’s absolutely no reason to have the needle be a separate mesh.
You probably wouldn’t even be able to tell the different between that an a rotating texture.

Either way. Use the animation blueprint directly for this one.
Fast path is not applicable. Have the BP code inside the animation graph. Put a Rotate bone node for the needle bone. Set the rotation value to be whatever the BP math tells you.
Test the axis manually as they may not be what you expect.

1 Like

Hi, thanks for the info. Sounds like using the rig I made and the anim graph is simply the best way to do it.

What is Fast path mean?

Usually for characters and animations you want good performance.

On an object it doesn’t really matter.
You could convert it to 2 static meshes and not use animations at all - it just depends on the situation.

I doubt you’ll get performance issues over 1 spinning bone (still, turn it off when not in use - activate the rotation with a boolean)

1 Like

thanks @MostHost_LA

since doing it with static meshes was quick to set up I went ahead and did that. But I still have the rigged version so I will mess around with that workflow later just so I know it as well for the future. Thanks for extra info about optimization considerations, that’s good to know.

Just came here to say this is my favorite phrase, or moreso: Just make a material do it. :smiley:

It’s a good idea but I already have a working model. I am afraid a material would not have the same level of depth and realism as well, since there is several components involved with the dial and lens of the compass. Since this compass is the primary actor in the game and usually seen close up, I think having it modeled as it is constructed in real life is worth the extra expense.

I can hear you on the modeling. As I was reading your initial post, i could see in my minds eye the jiggle/waggle of a compass needle, and whilst I agree with Mr LA, usually a material is best, I can see why you might want a mesh.

That so, MY (admittedly semi-experienced) suggestion is to use a variable to keep track of where your needle ought to point to, and then in the anim-bp, FInterp/LERP between it’s current state to that new state. If you put a delay, or a smooth enough interp, it ought to always be slightly lagging behind where it wants to point to (whilst in motion) and then when the target stops moving, ought to slowly/smoothly settle down.

1 Like

@IlIFreneticIlI working on that now :slight_smile:

in order to keep the pivot of the SM you need to enable “bake pivot in vertex” option on import and disable combine meshes. then you can use an add rotation movement component or something similar.

you can also use the “import into level” option to create an actor (bp) with static mesh components instead of one SM.

1 Like

@didel23 perfect! this is exactly option I was looking for. This will make work a little faster if I have to do this again.