Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #include "OdZera.h"
- #include "SUMCharacter.h"
- // Sets default values
- ASUMCharacter::ASUMCharacter(FObjectInitializer const &ObjectInitializer) : Super(ObjectInitializer)
- {
- CameraOne = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("CameraOne"));
- CameraTwo = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("CameraTwo"));
- MeszkaPostaci = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Meszka"));
- CameraBoom = ObjectInitializer.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
- static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMesh(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere'"));
- static ConstructorHelpers::FObjectFinder<UMaterial> Material_Blue(TEXT("MaterialInstanceConstant'/Game/StarterContent/Materials/M_Water_Lake.M_Water_Lake'"));
- MeszkaPostaci->SetStaticMesh(StaticMesh.Object);
- MeszkaPostaci->SetMaterial(0, Material_Blue.Object);
- MeszkaPostaci->SetSimulatePhysics(true);
- MeszkaPostaci->SetCollisionProfileName("BlockAll");
- MeszkaPostaci->AttachTo(RootComponent);
- // Set size for collision capsule
- GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
- // Don't rotate when the controller rotates. Let that just affect the camera.
- bUseControllerRotationPitch = false;
- bUseControllerRotationYaw = false;
- bUseControllerRotationRoll = false;
- // Configure character movement
- GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
- GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
- // Create a camera boom (pulls in towards the player if there is a collision)
- CameraBoom->RelativeRotation = FRotator(-60.f, 60.0f, 0.f);
- CameraBoom->TargetArmLength = 500.0f; // The camera follows at this distance behind the character
- //CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
- CameraBoom->bDoCollisionTest = true; // Don't want to pull camera in when it collides with level
- CameraBoom->AttachTo(RootComponent);
- // Create a follow camera
- CameraOne->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
- CameraOne->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
- PrimaryActorTick.bCanEverTick = true;
- }
- // Called when the game starts or when spawned
- void ASUMCharacter::BeginPlay()
- {
- Super::BeginPlay();
- }
- // Called every frame
- void ASUMCharacter::Tick( float DeltaTime )
- {
- Super::Tick( DeltaTime );
- //CameraBoom->RelativeRotation = FRotator(-60.f, 0, 0.f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement