x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

how to move character with mouse click?

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 ...

Product Version: UE older version
Tags:
more ▼

asked Aug 01 '17 at 02:26 PM in C++ Programming

avatar image

lueha55
17 3 4 9

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Aug 01 '17 at 03:11 PM

avatar image

Nachtmahr
6.8k 143 24 166

avatar image lueha55 Aug 02 '17 at 10:48 AM

I don't know how to use it. Could you explain it a little bit more?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question