I have a 4.9 project where most of the functionality is controlled through custom c++ classes. I am finding it hard to use the Leap Motion in this setup.
For now I have managed to spawn a blueprint actor with the Leap:
and I have a LeapActor class with the constructor :
ALeapActor::ALeapActor(const class FObjectInitializer& PCIP) : Super(PCIP)
{
PrimaryActorTick.bCanEverTick = true;
static ConstructorHelpers::FObjectFinder<UBlueprint> ItemBlueprint(TEXT("Blueprint'/Game/FirstPerson/Blueprints/LeapArmsActor.LeapArmsActor'"));
if (ItemBlueprint.Object){
MyItemBlueprint = (UClass*)ItemBlueprint.Object->GeneratedClass;
}
}
which is spawned inside my Custom PlayerController:
UWorld* const World = GetWorld();
FVector pos(0.0, 0.0, 300.0);
LeapActor = World->SpawnActor<ALeapActor>(ALeapActor::StaticClass(), pos, FRotator::ZeroRotator);
This works, and i can see the hands move as they should, but obviously they wont move with my first person character yet. I therefore tried to change the location of “LeapActor”, but cannot seem to just write the following below, inside the Tick function. This will not affect the position at all. (I checked the output of LeapActor->GetActorLocation() and it does not seem to be affected)
x += 1.0;
FVector NewPosition(x, 0.0, 300.0 );
LeapActor->SetActorLocation(NewPosition);
Any Idea on how to fix this, or any other tips on using Leap Motion in a c++ setup is much appreciated. I looked at the [getnamo plugin][2] but cant get it to work without using the VRPlayerController or LeapRiggedCharacter