i tried creating a rotating platform BP, based off of my moving platform BP, (I’m following the " Unreal Engine 5 C++ Developer: Learn C++ & Make Video Games" tutorial, i am at chapter 66, and i can’t access my “Moving” and “rotation” tab, none of the UPROPERTY(EditAnywhere) functions that i added in the Header file are in the class based off of the original, does anyone know the problem here? (i am 6:31 seconds into the video, for anyone who is curious)
Have you compiled successfully? Could you show your blueprint and code please?
compiling works just fine, the following is the code from my header file, followed by the code in my Cpp file for the moving platforms:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “CoreMinimal.h”
#include “GameFramework/Actor.h”
#include “MovingPlatform.generated.h”
UCLASS()
class OBSTACLEASSAULT_API AMovingPlatform : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMovingPlatform();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
private:
UPROPERTY(EditAnywhere, Category="Moving")
FVector PlatformValocity = FVector(100, 0, 0);
UPROPERTY(EditAnywhere, Category="Moving")
float MoveDistance = 100;
UPROPERTY(EditAnywhere, Category="Rotation")
FRotator RotationValocity;
FVector StartLocation;
void MovePlatform(float DeltaTime);
void RotatePlatform(float DeltaTime);
bool ShouldPlatformReturn() const;
float GetDistanceMoved() const;
};
// 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);
MovePlatform(DeltaTime);
RotatePlatform(DeltaTime);
}
void AMovingPlatform::MovePlatform(float DeltaTime)
{
if (ShouldPlatformReturn())
{
FVector MoveDirection = PlatformValocity.GetSafeNormal();
StartLocation = StartLocation + MoveDirection * MoveDistance;
SetActorLocation(StartLocation);
PlatformValocity = -PlatformValocity;
}
else
{
FVector CurrentLocation = GetActorLocation();
CurrentLocation = CurrentLocation + (PlatformValocity * DeltaTime);
SetActorLocation(CurrentLocation);
}
}
void AMovingPlatform::RotatePlatform(float DeltaTime)
{
AddActorLocalRotation(RotationValocity * DeltaTime);
}
bool AMovingPlatform::ShouldPlatformReturn() const
{
return GetDistanceMoved() > MoveDistance;
}
float AMovingPlatform::GetDistanceMoved() const
{
return FVector::Dist(StartLocation, GetActorLocation());
}
And the blueprint?
Maybe I misunderstood, what do you mean by you can’t access them?
my custom catagories aren’t showing up when i create a blueprint based off of my moving platform, look at the details panel
Oh I see what you’re saying now, sorry.
With that said by any chance do you have 2 BP_MovingPlatforms and have it parented to the wrong one?
If not, what version are you using?
AH YES, this was indeed the case… thank you for pointing this out to me!
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.