BatteryMan.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "BatteryMan.h"
// Sets default values
ABatteryMan::ABatteryMan()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
//dimensione capsula
GetCapsuleComponent()->InitCapsuleSize(42.0f, 96.0f);
//per non far girare il personaggio ma la videocamera:
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
//il personaggio si girerà nella direzione in cui sta camminando
GetCharacterMovement()->bOrientRotationToMovement = true;
GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f);
GetCharacterMovement()->JumpZVelocity = 600.0f;
GetCharacterMovement()->AirControl = 0.2f;
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->SetupAttachment(RootComponent);
//distanza della telecamera dal personaggio
CameraBoom->TargetArmLength = 300.0f;
CameraBoom->bUsePawnControlRotation = true;
FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName);
FollowCamera->bUsePawnControlRotation = false;
}
// Called when the game starts or when spawned
void ABatteryMan::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ABatteryMan::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ABatteryMan::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
BatteryMan.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "Components/StaticMeshComponent.h"
#include "Components/InputComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/Controller.h"
#include "GameFramework/SpringArmComponent.h"
#include "Blueprint/UserWidget.h"
#include "BatteryMan.generated.h"
UCLASS()
class BATTERYMAN_01_API ABatteryMan : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ABatteryMan();
UPROPERTY(VisibleAnywhere, CPF_BlueprintReadOnly, Category = Camera)
USpringArmComponent* CameraBoom;
UPROPERTY(VisibleAnywhere, CPF_BlueprintReadOnly, Category = Camera)
UCameraComponent* FollowCamera;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};
Console error
Error MSB3073 command ““C:\Program Files\Epic Games\UE_4.27\Engine\Build\BatchFiles\Build.bat” BatteryMan_01Editor Win64 Development -Project=“D:\path\BatteryMan_01\BatteryMan_01.uproject” -WaitMutex -FromMsBuild” exited with code 6. BatteryMan_01 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets 47