Unreal Engine 4.x Scripting with C++ Cookbook by John P. Doran

Unreal Engine 4.x Scripting with C++ Cookbook by John P. Doran

Author:John P. Doran [John P. Doran]
Language: eng
Format: epub
Tags: COM012040 - COMPUTERS / Programming / Games, COM051070 - COMPUTERS / Programming Languages / C++, COM057000 - COMPUTERS / Virtual Worlds
Publisher: Packt Publishing
Published: 2019-03-29T07:30:30+00:00


if (HitResult.Actor != nullptr)

{

auto Class = HitResult.Actor->GetClass();

if (Class->ImplementsInterface(

UInteractable::StaticClass()))

{

if (IInteractable::Execute_CanInteract(

HitResult.Actor.Get()))

{

IInteractable::Execute_PerformInteract(

HitResult.Actor.Get());

}

}

}

}

}

void AInteractingPawn::SetupPlayerInputComponent(UInputComponent*

InInputComponent)

{

Super::SetupPlayerInputComponent(InInputComponent);

InInputComponent->BindAction("Interact", IE_Released, this,

&AInteractingPawn::TryInteract);

}

Now, create a new GameMode in either C++ or Blueprint, and set InteractingPawn as our default Pawn class.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.