Incorrect CameraComponent Transform

From what I can tell it appears that the transformation being applied to the CameraComponent that is parented to another component isn’t done properly. In 4.11.2 it worked perfectly. In 4.12.2 it’s all over the place as shown in the three images below. That is, first at Pitch = 0.0 it is at one location, then Pitch = 1.0, then Pitch reset back to 0.0 but it isn’t positioned at the correct location.

Image 1 (Pitch = 0.0)

Image 2 (Pitch = 1.0)

Image 3 (Pitch = 0.0)

Hi ,

I tried to reproduce the issue that you are describing, but was unable to do so. I tried using a default character class and adjust the pitch of the camera in the Blueprint, but it seemed to be behaving normally. Is your Blueprint derived from a custom code class? If so, would it be possible to see the code for how you are setting up the camera component and its parent in the class?

, yes I was using a custom class that created the objects using CreateDefaultSubobject<> as shown in the code below:

    .h
        UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Components)
        USceneComponent* DefaultSceneRoot;
    
        UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Components)
        USpringArmComponent* CameraSpringArm;
    
        UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Components)
        UCameraComponent* Camera;
    
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SpringArm")
        float TargetArmLength;
    
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SpringArm")
        bool EnableCameraLag;
    
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SpringArm")
        float CameraLagSpeed;
    
    
    .cpp
        DefaultSceneRoot = CreateDefaultSubobject<USceneComponent>(TEXT("DefaultSceneRoot"));
        CameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraSpringArm"));
        Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
    
        TargetArmLength = 400.0f;
        EnableCameraLag = true;
        CameraLagSpeed = 3.0f;
    
        AutoPossessPlayer = EAutoReceiveInput::Player0;

The sub-components were not added in the BP editor but via code only.

I have since removed the creation in code, and manually added them in the level editor and now I don’t have this problem.

Thank you,

I tried using your setup in both a custom Actor class and a custom Character class, and unfortunately in a Blueprint derived from either class the camera seemed to behave normally when I modified the pitch value. There is likely something specific that I am missing. I understand that you are no longer experiencing the issue, but it would still be helpful for us to be able to reproduce the issue so we can examine it. If you have a , would it be possible for you to create a test class that shows the unusual behavior and provide that to us? If you need to share it privately, you can set your comment with that information to only be viewable by yourself and the moderators.

, I am a little preoccupied at the moment trying to finish up my game, but I’ll keep a look out for this issue, and if an opportunity presents itself I’ll investigate it further and post a follow up. If possible, I’ll export the asset as its own project and make it available to you. Unfortunately sometimes the asset migration tool exports a little too much.

Hi ,

If you have that available, that would be great, though I fully understand if you are too busy at the moment. In order to set a comment to private, you can click the down-arrow that should be right below the comment button to the right of where you enter text. That allows you to limit who can view the comment that you are entering (it defaults to Everyone).

Alternatively, you can also [send me a PM][1] on the forums.

I have a 4.11.2 and 4.12.2 version of the project that show the problem. Would you like to see them? The smallest size is 70MB (mostly textures and other assets) per zipped file.

How do I set the comment to be only visible to myself and the moderators?

Thank you,

Hi ,

Sorry for taking so long to get back to this issue. I was able to dig into it some more again today, and I believe the issue is related to the camera being attached in the construction script. When I changed the Attach Type to Keep World Position, the movement of the camera whenever the Blueprint was compiled stopped occurring. The AttachTo nodes have been deprecated, and when I tried using the new nodes the same behavior occurred, with the same change appearing to correct the issue.

This may not mean much to you, since I believe you have found your own way around the issue. I just wanted to mention what I found in case someone else runs into this same issue in the future.