Hi guys
I am getting better with cameras however I have ran in to something that may actually be a bug or limitation.
I created a scenario where a player is spawned with more then one camera. No problem there. I extend the class with blueprint, add a skeletal mesh to it, again no problem.
The issue comes when I try to attach one of my Cameras to a socket in my Skeletal mesh.
The cameras are of course inherited. The issue is that inherited cameras can not be edited so I can not attach it to my socket. Now, I can of course add a camera through the
extended blueprint and attch it to my socket in my skeletal mesh with no problem. However it is preferable to use the cameras I created through code in my CPP file.
I reasearched this a lot and I have found mixed results. Some are saying that Unreal Engine is simply currently very limited with what can be done with inherited assets on a
extended class. Others say that there is a way to get around this with code however I have not been able to find information about that.
Anyone have any idea about this?
More info:
Unreal Engine 4.12.3
Visual Studio Enterprise 2015 version: 14.0.25123.00 Update 2
Windows 10 64 bit.
I am also attaching a screen shot of what I mean regarding the socket and inherited attribute issue. So any ideas anyone? Is this a limitation of Unreal Engine or something I
can get around? For now I am simply adding my cameras through extended blueprint but I would like to get around doing this in the future doing this.
===
.h file
#pragma once
#include “GameFramework/Character.h”
#include “camMan.generated.h”
UCLASS(config = Game)
class AcamMan : public ACharacter
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
class USpringArmComponent* CameraBoom;
/** Follow camera */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
class UCameraComponent* CameraMan;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
USkeletalMeshComponent* followMe = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("VisualRepresentation"));
public:
AcamMan();
};
====================
CPP file:
// Fill out your copyright notice in the Description page of Project Settings.
#include “CameraMan.h”
#include “camMan.h”
// Sets default values
AcamMan::AcamMan()
{
AutoPossessPlayer = EAutoReceiveInput::Player0;
CameraMan = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraMan"));
RootComponent = CameraMan;
CameraMan->SetRelativeLocation(FVector(0, 0, 0));
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->SetupAttachment(RootComponent);
CameraBoom->TargetArmLength = 300.0f;
followMe->SetRelativeLocationAndRotation(FVector(0, 0, 0), FRotator(0, 0, 0));;
CameraBoom->AttachTo(followMe);
CameraMan->AttachTo(CameraBoom);
CameraMan->SetupAttachment(CameraBoom, USpringArmComponent::SocketName);
}