Advertisement
Guest User

Untitled

a guest
May 4th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.78 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #include "OdZera.h"
  4. #include "SUMCharacter.h"
  5.  
  6.  
  7. // Sets default values
  8. ASUMCharacter::ASUMCharacter(FObjectInitializer const &ObjectInitializer) : Super(ObjectInitializer)
  9. {
  10.     CameraOne = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("CameraOne"));
  11.     CameraTwo = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("CameraTwo"));
  12.     MeszkaPostaci = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Meszka"));
  13.     CameraBoom = ObjectInitializer.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
  14.    
  15.     static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMesh(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere'"));
  16.  
  17.     static ConstructorHelpers::FObjectFinder<UMaterial> Material_Blue(TEXT("MaterialInstanceConstant'/Game/StarterContent/Materials/M_Water_Lake.M_Water_Lake'"));
  18.  
  19.     MeszkaPostaci->SetStaticMesh(StaticMesh.Object);
  20.     MeszkaPostaci->SetMaterial(0, Material_Blue.Object);
  21.  
  22.     MeszkaPostaci->SetSimulatePhysics(true);
  23.     MeszkaPostaci->SetCollisionProfileName("BlockAll");
  24.  
  25.     MeszkaPostaci->AttachTo(RootComponent);
  26.  
  27.  
  28.     // Set size for collision capsule
  29.     GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
  30.  
  31.  
  32.     // Don't rotate when the controller rotates. Let that just affect the camera.
  33.     bUseControllerRotationPitch = false;
  34.     bUseControllerRotationYaw = false;
  35.     bUseControllerRotationRoll = false;
  36.  
  37.     // Configure character movement
  38.     GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...  
  39.     GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
  40.  
  41.  
  42.  
  43.     // Create a camera boom (pulls in towards the player if there is a collision)
  44.    
  45.     CameraBoom->RelativeRotation = FRotator(-60.f, 60.0f, 0.f);
  46.     CameraBoom->TargetArmLength = 500.0f; // The camera follows at this distance behind the character  
  47.     //CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
  48.     CameraBoom->bDoCollisionTest = true; // Don't want to pull camera in when it collides with level
  49.     CameraBoom->AttachTo(RootComponent);
  50.     // Create a follow camera
  51.  
  52.     CameraOne->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
  53.     CameraOne->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
  54.  
  55.    
  56.     PrimaryActorTick.bCanEverTick = true;
  57.  
  58. }
  59.  
  60. // Called when the game starts or when spawned
  61. void ASUMCharacter::BeginPlay()
  62. {
  63.     Super::BeginPlay();
  64.    
  65. }
  66.  
  67. // Called every frame
  68. void ASUMCharacter::Tick( float DeltaTime )
  69. {
  70.     Super::Tick( DeltaTime );
  71.     //CameraBoom->RelativeRotation = FRotator(-60.f, 0, 0.f);
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement