-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorldPosition.cpp
More file actions
40 lines (28 loc) · 1.1 KB
/
WorldPosition.cpp
File metadata and controls
40 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Fill out your copyright notice in the Description page of Project Settings.
#include "WorldPosition.h"
#include "GameFramework/Actor.h"
// Sets default values for this component's properties
UWorldPosition::UWorldPosition()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UWorldPosition::BeginPlay()
{
Super::BeginPlay();
//Getting an objects name, ie. Cube_01
FString ObjectName = GetOwner()->GetName();
UE_LOG(LogTemp, Warning, TEXT("Object Name Is %s"), *ObjectName);
//Getting an objects location at x, y, and z
FString ObjectPosition = GetOwner()->GetActorLocation().ToString();
UE_LOG(LogTemp, Warning, TEXT("%s position is %s"), *ObjectName, *ObjectPosition);
}
// Called every frame
void UWorldPosition::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}