Hello,
I’m trying to code a RTS. The player controller just moves around a pawn that’s basically a camera hovering in the sky.
My Unit class inherits from APawn, and (other than classic members like life, defenseValue…) only has a CapsuleComponent (that I mainly use for collisions), a SkeletalMeshComponent (using the default UE4 guy atm), and a PawnMovementComponent, using the default parameters (which should allow me to move the unit around). The pawn is possessed by the default AIController.
Here is the function called by the player when ordering a move :
void AUnit::moveTo(const FVector location)
{
if (GetWorld())
{
UNavigationSystem *const navSys = GetWorld()->GetNavigationSystem();
float const distance = FVector::Dist(location, GetActorLocation());
if (navSys && (distance > 50.f))
navSys->SimpleMoveToLocation(GetController(), location);
}
}
Nothing very fancy here. When I select the unit and order it to move more than 50.f units away, here is what happens : GIF | Gfycat (gif/video link).
Any idea where it could come from? The SimpleMoveToLocation is called, and executed. The PawnMovementComponent seems to be called (because of the running animation), but the actor just stands there.
Oh and also, I set up a NavigationVolume in the level : http://i.imgur.com/ITX7lRA.png
Thanks in advance to anyone who is willing to help me.