Getting Extra Part to GetName()

I’m trying to print out a platforms name to the log.

I have saved the GetName() function to a FString and this is what appears.

In the video there isn’t the whole UAID part.

BP_MovingPlatform_C_UAID_D0509982A8E62EAA01_1776767776

Would you mind showing your code please?

// Fill out your copyright notice in the Description page of Project Settings.

#include “MovingPlatform.h”

// Sets default values

AMovingPlatform::AMovingPlatform()

{

// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.

PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned

void AMovingPlatform::BeginPlay()

{

Super::BeginPlay();



StartLocation = GetActorLocation();

}

// Called every frame

void AMovingPlatform::Tick(float DeltaTime)

{

Super::Tick(DeltaTime);

// Move platform in direction

    // Get Platform Location

FVector CurrentLocation = GetActorLocation();

    // Create Vector

    // Set Location

CurrentLocation = CurrentLocation + (PlatformVelocity * DeltaTime);

SetActorLocation(CurrentLocation);

// Send plaform back

    // Check Distance

float DistanceMoved = FVector::Dist(StartLocation, CurrentLocation);

    // Reverse Direction if needed

if (DistanceMoved > MoveDistance)

{

    float Overshoot = DistanceMoved - MoveDistance;

    FString PlatformName = GetName();

    UE_LOG(LogTemp, Display, TEXT("Overshoot Distance of %s: %fcm"), *PlatformName, Overshoot);

    FVector MoveDirection = PlatformVelocity.GetSafeNormal();

    StartLocation = StartLocation + MoveDirection * MoveDistance;

    SetActorLocation(StartLocation);

    PlatformVelocity = -PlatformVelocity;

}

}

I’m not able to reproduce this on my end. If you want me to look into this further I think I would need to see your project.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms