Download

Move camera to weapon socket

I have been trying to move my camera to a socket of the currently equipped weapon but can’t figure out how to get the location right.
I get it to move from the regular first person view smoothly to a new location but I can’t figure out how to get it to move to the socket location properly.
When aiming I align the weapon to the character’s face, but since different weapons have sights in different locations I figured I need to adjust the camera slightly depending on weapon to ensure the sights line up without having to mess with the animations.

I’d be very thankful for some help with this. :slight_smile:

Add some dummy component at place where you want camera. Then you can move that component in 3d preview when you want to adjust stuff. You can also snap (or attach) that dummy to one of sockets of weapon in construction script). For such component i think best would be arrow.

Thank you!

I tried using a dummy component previously that I attached to the weapon’s camera socket at begin play but wasn’t able to figure out how to get it’s location so I can smoothly move the camera to it. Figured it might be easier than getting the location of the weapon’s socket but I still wasn’t able to figure it out. I need to make the camera move there smoothly so I can’t just attach it.

could you please explain me a bit in more details how it should be done and how it should work?

Do you mean I should attach dummy weapon to the character? then move the camera where I want it? if it is the idea, I think it would be difficult to adjaut each weapon.
or do you mean add camera to a weapon BP actor?

Please take a look at my similar post :
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1741828-how-can-i-control-pawn-s-rotation-from-another-actor-s-camera

Any help is greatly appreciated! I got stuck with it(
help me please to figure this out!