I’m going thru this simple tutorial, I followed the instructions quite precisely, twice, but the actor doesn’t have a Transform under Details and it’s not visible:
Proof I can follow instruction & my results: UnrealCppTrying - Google Docs
help?
I’m going thru this simple tutorial, I followed the instructions quite precisely, twice, but the actor doesn’t have a Transform under Details and it’s not visible:
Proof I can follow instruction & my results: UnrealCppTrying - Google Docs
help?
Here’s my .h:
`
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “CoreMinimal.h”
#include “GameFramework/Actor.h”
#include “FloatingActorTwo.generated.h”
UCLASS()
class QUICKCPPTRY2_API AFloatingActorTwo : public AActor
{
UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* VisualMesh;
GENERATED_BODY()
public:
// Sets default values for this actor’s properties
AFloatingActorTwo();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};`
.cpp
`
// Fill out your copyright notice in the Description page of Project Settings.
#include “FloatingActorTwo.h”
// Sets default values
AFloatingActorTwo::AFloatingActorTwo()
{
// 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;
//from site
VisualMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
VisualMesh->SetupAttachment(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));
if (CubeVisualAsset.Succeeded())
{
VisualMesh->SetStaticMesh(CubeVisualAsset.Object);
VisualMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
}
}
// Called when the game starts or when spawned
void AFloatingActorTwo::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AFloatingActorTwo::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FVector NewLocation = GetActorLocation();
FRotator NewRotation = GetActorRotation();
float RunningTime = GetGameTimeSinceCreation();
float DeltaHeight = (FMath::Sin(RunningTime + DeltaTime) - FMath::Sin(RunningTime));
NewLocation.Z += DeltaHeight * 20.0f; //Scale our height by a factor of 20
float DeltaRotation = DeltaTime * 20.0f; //Rotate by 20 degrees per second
NewRotation.Yaw += DeltaRotation;
SetActorLocationAndRotation(NewLocation, NewRotation);
}
`
NEVERMIND.
I had it in blueprint mode rather than c++.
wasted most of a day.
ugh.
but the tutorial is fine.
Put your
UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* VisualMesh;
Below your contructor in public: section