Game Mode, Camera
This commit is contained in:
@ -1,11 +1,41 @@
|
||||
#include "GasaCharacter.h"
|
||||
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
|
||||
AGasaCharacter::AGasaCharacter()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
|
||||
UCharacterMovementComponent*
|
||||
Movement = GetCharacterMovement();
|
||||
Movement->bOrientRotationToMovement = true;
|
||||
Movement->bConstrainToPlane = true;
|
||||
Movement->bSnapToPlaneAtStart = true;
|
||||
Movement->RotationRate = FRotator(0.0, 400.f, 0.0);
|
||||
|
||||
bUseControllerRotationPitch = false;
|
||||
bUseControllerRotationRoll = false;
|
||||
bUseControllerRotationYaw = false;
|
||||
|
||||
USceneComponent* root_component = GetRootComponent();
|
||||
USkeletalMeshComponent* mesh = GetMesh();
|
||||
|
||||
CamSpringArm = CreateDefaultSubobject<USpringArmComponent>("Camera Spring Arm");
|
||||
CamSpringArm->SetupAttachment(root_component);
|
||||
CamSpringArm->SetRelativeRotation( FQuat::MakeFromEuler(FVector(0.0, -35.0, 0.0)));
|
||||
CamSpringArm->TargetArmLength = 400.0f;
|
||||
|
||||
CamSpringArm->bInheritPitch = false;
|
||||
CamSpringArm->bInheritYaw = false;
|
||||
CamSpringArm->bInheritRoll = false;
|
||||
|
||||
Camera = CreateDefaultSubobject<UCameraComponent>("Camera");
|
||||
Camera->SetupAttachment(CamSpringArm);
|
||||
|
||||
Weapon = CreateDefaultSubobject<USkeletalMeshComponent>("Weapon");
|
||||
Weapon->SetupAttachment(GetMesh(), FName("WeaponAttach"));
|
||||
Weapon->SetupAttachment(mesh, FName("WeaponAttach"));
|
||||
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
#include "GasaCharacter.generated.h"
|
||||
@ -9,6 +10,14 @@ class GASA_API AGasaCharacter : public ACharacter
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
#pragma region Camera
|
||||
UPROPERTY(EditAnywhere, Category="Camera")
|
||||
UCameraComponent* Camera;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Camera")
|
||||
USpringArmComponent* CamSpringArm;
|
||||
#pragma endregion Camera
|
||||
|
||||
#pragma region Combat
|
||||
UPROPERTY(EditAnywhere, Category="Combat")
|
||||
TObjectPtr<USkeletalMeshComponent> Weapon;
|
||||
|
Reference in New Issue
Block a user