Changing rotation axis depending on angle

I am designing a futuristic tank, and I came up with a novel way to elevate the cannon to make it look/act more sci-fi. When the barrel is pointing up, it rotates around one axis, but while rotating down, it uses a different one. When it is level, both axes are in line with the rotating part.


Up, rotating around the back circle


Down, rotating around the front circle


Level, both circles aligned

To summarize, when the player looks down, I want it to use the forward pivot, and when the player looks up, I want it to use the back pivot. It should also be seamless, so the player can’t “feel” that the axis is changing without looking at the joint.

I am currently using static meshes via this old UE4 tutorial. If this cannot be done with static meshes, I totally understand. Skeletal meshes are a bit out of my wheelhouse right now.

Thanks for any help!

You can do it using static meshes, but with skeletal mesh it is much easier.

Any words of advice as to how to do it with static meshes?

Potential fix: I zeroed the pivoting oblect to one of the two pivots. Then I created a new object in Blender consisting of a small solid and a socket. The solid was placed in such a way as to be invisible (I am sure there are ways to simply set it to be invisible, but this was quick and dirty using my current knowledge), with the zero at one pivot point and the socket at the other. Then I placed the “invisible pivot” object in one pivot socket of the turret, and the regular pivot object placed in the socket of the invisible one. When I need to rotate one axis, I rotate the invisible pivot around its zero, and when I need to rotate the other, I rotate the regular pivot around its zero. This gives the illusion of the visible pivot having two axes of rotation.

Got it working. Here’s the event graph:

The clamp values represent the min/max for the whole range of motion. The zero in the less-than block represents the point at which the pivots switch.

I also ended up setting the other pivot to 0 at the end of each branch to ensure nothing gets out of position. So if “pivot” is moving, I also set “Invisible pivot” to 0 rotation at the same time.

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