Timeline for Aiming Down Sight is making Camera go to wrong location

Hi all,

I added a timeline for Aiming Down Sights.

I am using a weapon socket to aim to the correct location.

However when i try it, the camera completely flies off in the wrong direction.

Can someone please suggest what im doing wrong here?

Is it a timeline or code based issue?

Video ATTACHED

(post deleted by author)

It seems like you are lerping the position to a 3rd person camera and not your first person camera. Do you have the default 3rd person cam on a spring arm in your character BP?

@Everynone

@3dRaven yes i have the spring arm (boom) on a camera

So do you want to have the camera stay on the weapon during ADS and then return to the 3rd person view or do you have a 1st person position in mind for the relaxed stance?

Are you updating HipfireLocation? Take into account that the camera boom has it’s own parameters such as length that need to be changed. It would be better to probably un-parent the camera from the boom while in ads or you may be fighting it’s movement.

If you decide on keeping it then once you leave ads you need to set the same parameters for the spring arm and camera location as before ads’ing.

Also make sure you are not messing up local space and world space.
GetSocketLocation returns the coordinates in world space so you would need to transform it to local space if you want to use retrelativelocation.

#include "Kismet/KismetMathLibrary.h"

Convert location from local to world space:

FVector UKismetMathLibrary::TransformLocation(const FTransform& T, FVector Location)

Convert location from world to local space:

FVector UKismetMathLibrary::InverseTransformLocation(const FTransform& T, FVector Location)

or easier

So you would probably need this:

FVector ADSTransform = GetTransform().InverseTransformPosition(GetEquippedWeapon()->GetWeaponMesh()->GetSocketLocation(TEXT("ADS_View")));

to get the relative transform, or just do the calculations in world space :slight_smile:

Try going into an outside view and debug drawing spheres at the projected target coordinates to see where they line up in space. (set a longer persistent time and bind it to a keypress for tests)

@3dRaven it will all be 1st Person so literally just ADS location and back to relaxed location as 1st person.
Game is going to be fully 1st person.

I will review the rest of your post now.
Thanks for the help :slight_smile:

Am i better to remove the CameraBoom (SpringArm) as it is first person?

The reason I was using the SpringArm is to not have the camera shake too bad when attached to say a Head Bone.

My SpringArm is currently at 0.0f length and the camera is parented to it.

Also, is it better to do it overall in World Space? I am confused with moving the boom itself just to the ADS Socket created on the gun.

Personally I use Set View Target w/Blend. Have that handle transition from character cam to weapon cam which is a component in the weapon class. Weapon class event adjusts the socket offset based what optic is being used (red dot, holo, irons, acog etc).

thanks @Rev0verDrive - so a second camera?
I have seen people use this on youtube and i didn’t know if it was good practice? Or is that what a lot of studios do with 2 Cameras?

I don’t know about other studios, but I find it does the job I want it to do and is easy to manage.

thanks @Rev0verDrive im just finding it difficult to move my camera boom to an ADS socket. might try it your way.

Don’t have to move the boom, just the camera.