# How Do I Make My Hammer Rotate To Smash A Nail and Come back to its position?

Hi guys!
I’m doing a little project with a hammer as the main character.
I want him to smash a nail just by rotating on the Y axis at let say 70 degrees, and then come back at its position when I release the button.!
Right now I have this, so it is not much. But I believe I need a lerp somewhere, and a variable to store the start position for the hammer to comeback?
I believe if I find out this last bit I could be able to do the “Released”.
Thanks in advance for the tips! I’ll continue to experiment on my side!
alt text

I think a Timeline will be perfect for this. Make a Timeline with a curve like this, for instance:

And then just launch the timeline to hit. You can set it to Loop if you like.

Marvelous! You’re right on the spot! Thank you so much!

There is just a small problem : When I click, the hammer position itself in the forward direction even though I’m looking else where.
Do you know a node that could help me to use this timeline in any direction? Thanks alot again!

It’s just an example. Take your hammer’s rotation and put it into the A instead of 0,0,0, and change the B accordingly to what will work for you.

Will try that in the next few days. You da master!

Hey. Actually, that’s what the Relative Rotation is for, it’s supposed to rotate the hammer relatively to itself, and not the world. Are you sure you’re using relative, not World Rotation?

Hi there! I tried what you said before Tuerer and sadly it didn’t work. Or maybe I just made a mistake. The hammer stills hits in ONE direction only (the forward direction) even if he turns 90 degrees.

Maybe I need a variable that says “you’re looking this way, so you hit in this direction”?

Here is what I have right now. I have RelativeRotation.
Here what it looks like :

I see. Your hammer is a child to your camera, and its initial rotation is not 0.0.0. You can either see what the hammer rotation is and type it into A, and the same into B, but with Y-70, or you can do something like this:

Hi there!
So I solved the problem with my camera following too much the hammer (while he was smashing). I went to the BP of the hammer → Spring Camera component → In camera Settings I have unchecked the boxes “Inherit Pitch/Yaw/Roll”.
Now the camera is following the player when he walks/jumps but stay in place when he rotates. Nice!

Now, my ONLY problem is that the hammer still smash in ONE direction only. Like this :

And there is also a problem where I try to smash but since I’m walking the smashing animation by the timeline play super duper fast. You can maybe see it in the video. Is it possible to use a timeline while walking?

Once again, u da man. Thank you for your time. It really helps me to get better!

So I have made some progress (I guess) today.
My hammer can now smash in any direction it looks at.
But, I have this weird/fast animation going on not sure why (video : )

If someone could help me find WHY I can’t smash while moving, that would be great!

Something interferes with the movement, as it would seem. Can you show me the final BP as you have it?

And is there something else that influences the hammer position? Something that works all the time on tick or something.

This is all I have and the BP for the jump, which is the 3third person sample one.

Just in case it matters, here is the inspector of my hammer.

I’m not entirely sure, but I think the problem might be that you rotate not the Hammer, but the entire blueprint (self in the Set Relative Rotation), so you rotate everything, including the Mesh, from which you take the Rotation, so every moment of time the A in the ease changes, and that shouldn’t happen.

Try rotating only the Hammer, not everything at once.

I don’t have Set Relative Rotation, I have Set ACTOR Relative Rotation.
Every time I try to link your node “Set Relative Rotation” with my hammer, it goes : “Static Mesh Component Object Reference is not compatible with Actor Reference Object”.

I’m really lost here.
Maybe I didn’t say it before, but my hammer is a character BP. If that can help.

I have thought rotating an object would be easier than this. Daaaaamn.

Set “relative” rotation means you are going to rotate a component mesh (ie the physical hammer mesh) relative to the parent root component. So you can call your BP “Hammer” but that doesn’t mean it is a “hammer”. You want to rotate the static mesh component that is the actual hammer. So drag out the mesh component and search for set relative rotation.

OH MY GOD IT WORKS! AND IT MAKES SO MUCH SENSE IT HURTS MY BRAIN.

Both of you, thank you so much for helping me out. You are amazing. Now, I understand more blueprint than before, thanks to you two!

I will now “close” this thread!

No problem, I didn’t really do much, just kinda cherry picked at the end of this rather long help session haha But I am happy it works