31 lines
856 B
C++
31 lines
856 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#include "LFLandscapeGrassHack.h"
|
|
|
|
// Sets default values
|
|
ALFLandscapeGrassHack::ALFLandscapeGrassHack()
|
|
{
|
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
|
PrimaryActorTick.bCanEverTick = false;
|
|
Root = CreateDefaultSubobject<USceneComponent>("Root");
|
|
RootComponent = Root;
|
|
}
|
|
|
|
// Called when the game starts or when spawned
|
|
void ALFLandscapeGrassHack::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
UpdateGrass(Landscape);
|
|
}
|
|
|
|
void ALFLandscapeGrassHack::UpdateGrass(ALandscapeProxy* LandscapeToUpdate)
|
|
{
|
|
if(!IsValid(LandscapeToUpdate))
|
|
{
|
|
UE_LOG(LogTemp, Warning, TEXT("NO landscape has been assigned, cannot recreate grass"));
|
|
return;
|
|
}
|
|
FOccluderVertexArray arr;
|
|
LandscapeToUpdate->UpdateGrass(arr, true);
|
|
}
|