I should take a look at your blueprint but I assume you are making operations between rotators. You should try this function:
Greetings!
I have a static mesh as a child inside an actor. Both actors will rotate to face towards the direction of a spring arm that is also part of the actor. For reference, here is a screenshot showing my hierarchy.
The rotation works fine when the actor is level in world rotation (so no Roll or Pitch, only Yaw values). This can be seen in the following screenshot.
If I look down or up (add values to the Pitch), the WeaponMount mesh will follow correctly, but if I THEN look left or right, the rotation starts to get weird.
I want the WeaponMount to always be ‘attached’ to the SubMesh parent mesh, while being able to rotate on it’s local Yaw still, but this clearly ‘detaches’ it as the WeaponMount being to rotate in unwanted fashion.
Is there a tried and true method to achieving what I am after?
Thanks in advance!
You could try attaching it via a socket instead of letting it use its own transform. I have had a similar issue to this where the relative transform is out of whack to the parent transform, scaling on one axis would scale on the completely wrong one.
After spending months of trying to figure it out then giving up, I managed to figure it out shortly after posting this haha.
So I get the spring arm’s rotation relative to the SubMesh, and subtract the SubMesh World Yaw. That I plug in to the Yaw of a Set Relative Rotation for the WeaponMount.
Works like a charm now!
I’d tried a socket in the past but had similar results with no improvement. As stated in my other comment though I have now figured it out!
That look fine, just a little warning: don’t use too much operations between rotators, sometimes they messed up (because the reset or because interactions between Y,R,P), usually there’s always a function that do what you want to achieve! (answer yourself to your question and set it to solved, keep the answer hub in order )
Yeah I think it has to do with the mesh orientation, its why Epic insists on them all being on the +X facing axis and Z-up. It tends to happen to me when I adjust the mesh offset before the translation takes place.