At my wit's end. Aiming a skeletal mesh turret

I am doing my best to figure out a player controlled turret and I am about to give up. I want the player to be able to take control of a turret and the turret slowly point to where the player is aiming. This should be easy, but I am struggling to figure it out.

This turret has multiple swappable component skeletal meshes all driven by a shared skeleton.

When the player aims the camera, I want the skeletal mesh to match camera target over a period of time.

I find the target world location, the world turret pivot location, the local rotation of the turret pivot, the world rotation to the target, and every other thing I can think of. I have tried “Find Look at Rotation”, Find Relative Look at Rotation", and “Inverse Transform Direction”.

After passing these initial and target rotations through my Rinterp, I notice that the return values are getting stuck somewhere between the ‘current’ and ‘target’. The magnitude of this is directly correlated to the “Interp Speed”. At 0, the return value matches the “target” value.

I have tried debugging this thing for almost a month now and I can’t get anywhere. To the best of my understanding, when I set the “Target Rotation” variable in the turret, it is then read by the Animation Blueprint, but it is NOT updating the “Transform (Modify) Bone” nodes in the Anim Graph.

Please someone help me on this!

What movement component are you using?

I thought I had a movement component in there, but I guess I don’t. Ah, my turret is of the “default pawn” class and Epic’s documentation says I can’t have nice things like a movement component on anything other than a character.

After sleeping on it, I have a theory, but I don’t have time today to test it. I am reading the yellow “b_Pitch” bone’s x and y rotation, but updating the pitch x rotation and b_yaw y rotation. Maybe this has something to do with it?

I think the main problem is the Rinterp is not getting updated “current” rotational values. And I don’t know where the disconnect is.

Would be a lot easier to simply convert over to the character class. It has built in movement replication.

I wanted to return and explain the solution I used (for now). I created a simple control rig for the turret and had a “look at” control in there. I locked the axis of the pitch to just Y, and locked the axis of the yaw to just Z and it works great. I drive the location of the “target” with a simple line trace from the camera.

I have other issues to work out, but for now, this is more progress than I have made in weeks.

Check if the turret work with the aiming it you move in the world and tilt it on it’s side at an angle. Most of these simpler aiming mechanism break while in motion.

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