Tank turret rotation

I have a tank and the turret of this tank rotates with the main body. I want to move the tower independently of the main body. I am trying to move the tower only with the camera

This literally comes up about once every 3 months :slight_smile:

In the topic in the link, a turret was created using static mesh. I move my turret by rotating the bone. I tried to rotate it using the bone transformation node in the Animation Plan. When I set the rotation field as world field in the transform bone node, the turret moves independently of the hull. This is what I wanted, but in rough terrain the turret looks separate from the hull, so it didn’t work for me.

Now I have arranged the tank’s turret to rotate and move with the camera. The only problem is that the rotation of the main body is added to the turret, that is, the turret is affected by the main body. :smiley:

This one uses a skeleton :slight_smile:

1 Like

Man, I actually watched the video twice, but here the turret rotates with the body. Okay, it rotates the turret freely, but when the main body rotates, the turret rotates with it. I am looking for something that will not rotate the turret no matter which way the tank body turns, I tried component space on transform bone but it did not work. Am I misunderstanding something :smiley:

In your animation blueprint, read a value called “Turret World Rotation” that’s a rotator.
Set that as the world orientation of your turret bone.
Then, in your Pawn Tick function, read the control rotation, and forward that to the animation blueprint Turret World Rotation value.

1 Like

I think I have already done what you said.
Let me explain the code in the 1st picture. This code is to move turret by swiping for mobile

If I change the rotation space to world space in the 3rd picture, it works very well, but when I enter a rough terrain, the turret and barrel on the vehicle move as if they were detached from the body. :smiley: