Files
RailWorker2/Source/railwayWorker/RailwayCarriage.cpp
T

65 lines
2.3 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "RailwayCarriage.h"
#include "Components/StaticMeshComponent.h"
#include "Components/SphereComponent.h"
// Sets default values
ARailwayCarriage::ARailwayCarriage()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
//PrimaryActorTick.bCanEverTick = false;
// root
Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
RootComponent = Root;
// body mesh railway
railwayBody = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("railway"));
railwayBody->AttachTo(Root);
wheel_0 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("wheel_0"));
wheel_0->AttachTo(railwayBody);
wheel_1 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("wheel_1"));
wheel_1->AttachTo(railwayBody);
wheel_2 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("wheel_2"));
wheel_2->AttachTo(railwayBody);
wheel_3 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("wheel_3"));
wheel_3->AttachTo(railwayBody);
// support to focus component
dotCoordinate_0 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel1Focus"));
dotCoordinate_0->AttachTo(railwayBody);
dotCoordinate_1 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel2Focus"));
dotCoordinate_1->AttachTo(railwayBody);
dotCoordinate_2 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel3Focus"));
dotCoordinate_2->AttachTo(railwayBody);
dotCoordinate_3 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel4Focus"));
dotCoordinate_3->AttachTo(railwayBody);
dotCoordinate_4 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel5Focus"));
dotCoordinate_4->AttachTo(railwayBody);
dotCoordinate_5 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel6Focus"));
dotCoordinate_5->AttachTo(railwayBody);
dotCoordinate_6 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel7Focus"));
dotCoordinate_6->AttachTo(railwayBody);
dotCoordinate_7 = CreateDefaultSubobject<USceneComponent>(TEXT("sphereForWheel8Focus"));
dotCoordinate_7->AttachTo(railwayBody);
}
// Called when the game starts or when spawned
void ARailwayCarriage::BeginPlay()
{
Super::BeginPlay();
oldLocation = GetActorLocation();
}
/*
// Called every frame
void ARailwayCarriage::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
*/