Need help with attaching springarmcamera to actor

Hi,
I’m making a shooter and thought it would be neat to have all gunrelated stuff inside the gun blueprint so I’m making an AimDownSight function in my weapon blueprint with a gun camera.

First I tried to attach the gunCam to the gun using a springarm and when ADS I use “Set View Target with Blend” to switch between the player(springarm)camera and the weapon(springarm)camera and it works ok.

The problem is Animations making the guncamera bump up and down and when running and aiming I get seasick so I thought I would try another approach and when ADS I would attach the guncamera springarm to the player capsule in some way and control it with my mouse but I can’t get it to work.

I know I can have 2 springarms on my character and switch between them but I want to keep ALL gun logic contained in the gun BP and all communication with the gun handled through the gun interface so I can reuse the gun in different projects where i in the character BP just call (guninterface)Fire or (guninterface)ADS…

Anyone?
In my player Blueprint I have CameraBoom+Player Camera.
In My Weapon BP I have the ADS_CameraBoom+WeaponCamera.

When I try to attach the ADS_CameraBoom+WeaponCamera to the character capsule I can swithc the view to the weaponCam but I can not control the ADS_Cameraboom with the mouse. Does anyone have any hint for me how to solve that?

Thanks.

You don’t need the spring arm. The purpose of the spring arm is to prevent the camera from clipping the world/terrain/etc around you. Your ADS camera won’t have that issue. Just put it behind the sites where you like it and it will be in a static position on the weapon. Try removing the spring arm and see if that solves the issue.

Here’s a vid that might help:

Also, you can’t really aim down sights while running, at least not in the real world. I suppose you could do it in a game if you absolutely want to, but that’s not very realistic.

Hi,
thank you so much for your reply, I really appreciate it :slight_smile:

I start from the end:
I want ADS when more walking than running but my weapon animations are so bumpy I get seasick when attaching the camera to the weapon. It works ok when Im standing still but otherwise you get motionsickness. I already have a dynamic crosshair that widens when walk and aiming to represent worse accuracy and also maybe I will try and add a smooth cameramovement if aiming and walking…

I removed the springarm but it didn’t help and I think I should keep it since I do a 3d person game so weaponcam is not exacly placed on the weapon (Im more after a zoom effect).
Anyway as I wrote this reply I decided to cheat to get on with the project. I made an option to use guncam (shaky as it is) OR I just get the player cam and change FOV to get the zoom in effect.

I tried to do as he did in the video and it worked with deactivate playercam but it did not work to activate the guncam (when deactivating the player cam I just got some cam from inside the player mesh and I couldn’t get the picture from guncam to show.

I am still interested in how to fix this as I first intended:
2 Blueprints - PlayerBP and WeaponBP. I attach WeaponBP to PlayerBP as scene component.
*) Inside WeaponBP when I use get parent actor I get the PlayerBP.
*) Inside PlayerBP I have a normalCameraBoom and as a child PlayerCamera
*) Inside WeaponBP I have ADSCameraBoom and as a child WeaponCamera
*) When Aiming I want to Disable PlayerCamera and Enable WeaponCamera AND I want to move the ADSCameraBoom and Weaponcamera to the PlayerBPs Capsule component and let the mouse rotate the view as it did with the normalCameraBoom and PlayerCamera.

It shouldn’t be rocketscience to do this but in this case it seems it actually is and I seem too dumb to figure out how to do this haha

I’m sorry to hear that didn’t work for you. The way he did it in video should have worked fine, it did for me back when, but that was first person not third person.

My only other thought would be to detach the weapon from the player, but only when ADS is active. While it’s socketed, it’s going to move with the character pawn’s animations, so detach it when ADS is activated and set it’s world location and forward vector from the pawn’s. Move it a bit in front and up to eye level. Then reattach it to the socket when ADS is deactivated.

Or I suppose you could even just ignore the socketed weapon entirely (though you may have to deactivate inputs to it) when in ADS mode. Just use an entirely new weapon that spawns in with iron sights right in front of your pawn. Then it can disappear back into nothingness when you leave ADS. You’ll have to transfer some variables back and forth (like ammo counts) but that’s not too difficult. Just spawn it in slightly in front of, but not attached to, the character pawn.

Anyway, good luck.

Thank you again,
those are very interesting ideas. I will try them out later on when I revisit aiming. For now Im quite happy with the result of hijacking the playercam and change FOV or be able to use “true” guncam - bumpy as it is. Maybe do that as a difficulty setting… On easy I use FOV hijacking and on hard I use bumpycam :slight_smile:

Here is what it looks like right now:


Please comment if you see some obvious flaws (I only started with UE some few weeks ago and im no coder by trade).


Closeup

Thanks, I really appreciate your help :slight_smile: