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"

Mouse cursor show/hide issue

I'm trying to make 3d person character go to free-look mode with RMB pressed. When starting an app I'm able to hold RMB and rotate camera as far as I want (no limit).

 // Handle Mouse X
 void AMainCharacter::Turn(float Value)
 {
     if ((Controller != NULL) && (Value != 0.0f) && bIsMouseLookMode)
     {
         AddControllerYawInput(Value);
     }
 }
 
 // Handle Mouse Y
 void AMainCharacter::LookUp(float Value)
 {
     if ((Controller != NULL) && (Value != 0.0f) && bIsMouseLookMode)
     {
         AddControllerPitchInput(Value);
     }
 }
 
 // Handle RMB is pressed
 void AMainCharacter::OnStartMouseLook()
 {
     bIsMouseLookMode = true;
 
     APlayerController* MyController = GetWorld()->GetFirstPlayerController();
 
     MyController->bShowMouseCursor = false;
     MyController->bEnableClickEvents = false;
     MyController->bEnableMouseOverEvents = false;
 }

 // Handle RMB is released
 void AMainCharacter::OnStopMouseLook()
 {
     bIsMouseLookMode = false;
 
     APlayerController* MyController = GetWorld()->GetFirstPlayerController();
 
     MyController->bShowMouseCursor = true;
     MyController->bEnableClickEvents = true;
     MyController->bEnableMouseOverEvents = true;
 }

However, once I show mouse cursor it can't leave viewport area, so I can rotate my camera for a very limited degrees, even if I hide cursor again.

What I'm doing wrong? Is there any simple way to toggle mouse-look/mouse-click mode? Any help/advise is greatly appreciated.

Product Version: UE 4.10
Tags:
more ▼

asked Mar 13 '16 at 01:38 AM in C++ Programming

avatar image

Radamanteg
3 1 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

For your question:

GEngine->GameViewport->Viewport->LockMouseToViewport(false);

However, you probably run into the same problem there; you hit the windows screen edge and can't get anymore inputs from the mouse after that.

To solve the issue, you might give this a try (using your variable MyController here):

FInputModeGameOnly GameMode;         
MyController->SetInputMode(GameMode);

This SHOULD give you inputs even when you are at the edge of the screen.

more ▼

answered Mar 13 '16 at 04:47 PM

avatar image

Groatse
232 16 8 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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