I don’t know how to use it. Could you explain it a little bit more?
i m sorry for poor English.
I’d like to move to the destination with mouse click.
(destination = mouse click pos)
void ABaseCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent){
Super::SetupPlayerInputComponent(InputComponent);
InputComponent->BindAction("GetMousePos", IE_Pressed, this, &ABaseCharacter::GetMouseClicked);
}
// Called every frame
void ABaseCharacter::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
//or GetMouseCliecked HERE?
}
void ABaseCharacter::GetMouseClicked(){
FVector2D mousePos = FVector2D(0, 0);
APlayerController* pc = GetWorld()->GetFirstPlayerController();
pc->GetMousePosition(mousePos.X, mousePos.Y);
FVector worldPos = FVector(mousePos.X, mousePos.Y, 0);
FVector dir = FVector(0, 0, 0);
pc->DeprojectMousePositionToWorld(worldPos, dir);
AddMovementInput(worldPos, Speed);
}
Did I do anything wrong in code?
and How do I make a mouse show when I play games?
What should I do? I need help …
Yes probably a couple things. I would suggest to you that you create a new UE4 C++ Project of Top Down Template. Learn from the Code its easier to explain it here.