Skeletal Turret Rotation

I use to know how to do this, but its been forever, I’m trying to set up a turret that has 2 bones and a root bone (3 total)
I’m trying to get the turret to rotate to a dynamic target

I’m thinking I have to make a animation for it, but I’m not sure how to set that up.

1 Like

Hi, first you would use “get look at rotation” to find the rotation from your turret to the target. Then in the animation blueprint of the turret you would rotate the turret bone (not the root but the bone above the cannon in hierarchy) in z and then rotate the cannon in y to face the target.

In the transform modify bone node under rotation you would both times set “Replace Existing” and “World Space”.

hey, so I understand most of this except for to things

I’m not sure that that node is on top that is being referenced to by the modify bone nodes (is that a target variable?)

I’ve came across the “get look at rotation” before, but I’m not sure where I could use it, cause most of the node paths don’t connect latter on (maybe I’m using the wrong nodes)

Sorry, I meant this node here so “Find Look at Rotation”, I just typed it out of the head in the last post.

find_look_at_rotation.png

Basically you would have something like this inside of your Turret BP. Vehicle is the turret skeletal mesh (my vehicles and turrets reparent from the same bp cause they use the same weapon system, so therefore it’s called vehicle here)

Yes that’s a variable that I set in the event graph of the turret animation blueprint.

ok, I think I get this but it isn’t working, dose it matter if I use a bone name in the socket node?

Yup, what “Get Socket Location” does is it returns the location of the socket in your skeletal mesh. And you specify which socket you want by the name.

add_socket.png

To create a socket -> right click on a bone -> Add Socket
Then you can move the socket were you want it to be (I put it at the tip of the cannon, so to the muzzle. When I spawn the bullets I again use the location and rotation of this socket).

I can’t tell you out of the head what happens if you enter a bone name instead of a socket name.

ok, I needed to take a break I’m not sure if you still there but I still can’t seem to get this to work
am I doing something wrong?
this is in the turret blueprint:

https://i.gyazo.com/a58a0c8c892aefc09ff2be4b97284239.png

Hmm, what is not working/what is it doing right now and what do you want it to do? So I would need a little bit more information :slight_smile:

Is the input event (so the D Pressed) firing? (you can check this by doing a print afterwards and see if it prints anything on the screen when the game is running)

Next I would print the “TurretRotation” after you set it. What this should be doing right now is you’re tracking a position that is 1000cm in front of the “Camera” in the direction the “Camera” is facing.

If this blueprint does what you intended it to do, then did you set up the animation blueprint and set the skeletal mesh to use it?

I feel stupid, I forgot the set the animation blueprint in the skeletal mesh it was using, it was set to none before…
thank you for your help, this was frustrating me for a wile now :slight_smile: