Hello fellow Programmers,
I came across a problem, when i tried to make a turret look at the player. Other post on the HUB was not helpful to me
It was fairly easy in Blueprint.
My problem is that i cant acces the FindLookatRotation() function in C++.
void ATurretC::TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction)
{
if (PlayerInside)
{
FVector PlayerLoc = GetWorld()->GetFirstPlayerController()->GetCharacter()->GetActorLocation();
FRotator PlayerRot = UKismetMathLibrary::FindLookAtRotation(this->GetActorLocation,PlayerLoc);
FRotator NewRot = FMath::RInterpTo(StaticMesh2->GetComponentRotation(), PlayerRot, DeltaTime, 2);
}
else
{
// TODO, Set rot back to Default
//RootComponent->SetWorldRotation(FRotator(0, 0, 0));
}
}
Error: ‘FRotator UKismetMathLibrary::FindLookAtRotation(const FVector &,const FVector &)’ : cannot convert argument 1 from ‘overloaded-function’ to ‘const FVector &’
1> Reason: cannot convert from ‘overloaded-function’ to ‘const FVector’
Any other solution to replace UKismetMath Library?
Thank you all in advance,
szuecsg