Hello.
I was following this beginning guide: https://docs.unrealengine.com/latest/INT/Programming/QuickStart/4/index.html
I created the C++ FloatingActor and inserted it onto the level. I added a component ‘Cone’, which gave it a cone look in the preview screen, but if I try to play the game either inside the editor or on a standalone window, the actor won’t show up.
Here’s one screenshot: https://goo.gl/o1Lgo4 and here’s the Cone: https://goo.gl/l6xAyD
It shows up fine in the preview as you can see from the screenshot, but when I play the game there’s no indication of its existence. No shadows, no visual details, nothing. I can walk through it as if it didn’t exist.
Any ideas? I have a feeling I’m missing on some very basic little detail here…
Thanks in advance!
Here’s the actor code:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "FloatingActor.generated.h"
UCLASS()
class MATERIALISM_API AFloatingActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AFloatingActor();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
float RunningTime;
};
and:
// Fill out your copyright notice in the Description page of Project Settings.
#include "Materialism.h"
#include "FloatingActor.h"
// Sets default values
AFloatingActor::AFloatingActor()
{
// 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 AFloatingActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AFloatingActor::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
FVector NewLocation = GetActorLocation();
float DeltaHeight = (FMath::Sin(RunningTime + DeltaTime) - FMath::Sin(RunningTime));
NewLocation.Z = DeltaHeight * 20.0f;
RunningTime += DeltaTime;
SetActorLocation(NewLocation);
}