Download

Make reference to player controller

Hi! I have been searching all the morning how to make a reference to the player controller.

I want to make that the cone stop floating when I’m near it, but I dont know how to make it.

This is my code: (It compiles)



// Called every frame
void AFloatingActor::Tick(float deltaTime)
{
	Super::Tick( deltaTime );

	AFloatingActor::flotating(deltaTime);

}

void AFloatingActor::flotating(float time)
{
	FVector newLocation = GetActorLocation();

	float deltaHeight = (FMath::Sin(runningTime + time) - FMath::Sin(runningTime));
	newLocation.Z += deltaHeight * 20.0f;       //Scale our height by a factor of 20
	runningTime += time;
	SetActorLocation(newLocation);
}