Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
- #include "MyProject2.h"
- #include "KillerCube.h"
- AKillerCube::AKillerCube(const class FPostConstructInitializeProperties& PCIP)
- : Super(PCIP)
- {
- // Use a sphere as a simple collision representation
- static ConstructorHelpers::FObjectFinder<UStaticMesh> Mesh(TEXT("StaticMesh'/Game/Meshes/TemplateCube_Rounded.TemplateCube_Rounded'"));
- MeshComp = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("ModelComp"));
- MeshComp->BodyInstance.SetCollisionProfileName("PhysicsActor"); // Collision profiles are defined in DefaultEngine.ini
- MeshComp->StaticMesh = Mesh.Object;
- MeshComp->SetRelativeScale3D(FVector(0.25f, 0.25f, 0.25f));
- //MeshComp->SetSimulatePhysics(true);
- //MeshComp->BodyInstance.bSimulatePhysics(true);
- RootComponent = MeshComp;
- for (int i = 0; i < 10; i++)
- {
- TempMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("ModelComp1"));
- if (TempMesh != NULL && TempMesh->IsValidLowLevel())
- {
- TempMesh->BodyInstance.SetCollisionProfileName("PhysicsActor"); // Collision profiles are defined in DefaultEngine.ini
- TempMesh->StaticMesh = Mesh.Object;
- TempMesh->SetRelativeScale3D(FVector(0.25f, 0.25f, 0.25f));
- //TempMesh->SetSimulatePhysics(true);
- TempMesh->SetRelativeLocation(FVector(250, 0, 0));
- MeshArray.Add(TempMesh);
- }
- }
- // Die after 3 seconds by default
- InitialLifeSpan = 0;
- PrimaryActorTick.bCanEverTick = true;
- ForcePower = 100.f;
- }
- void AKillerCube::BeginPlay()
- {
- Super::BeginPlay();
- if (GEngine)
- {
- GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Blue, TEXT("THIS IS A THING NOW"));
- }
- }
- void AKillerCube::Tick(float DeltaSeconds)
- {
- Super::Tick(DeltaSeconds);
- //UE_LOG(LogTemp, Log, TEXT("Ticking!"));
- MeshComp->AddForce(FVector(0, 0, ForcePower));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement