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"

Having issues hiding mouse

This is much easier to show than explain so I made a short video demonstrating my two issues.

https://www.youtube.com/watch?v=KFCKpoUgNmg

ISSUE 1: Disabling / unsetting bShowMouseCursor doesn't seem to undo everything that setting bShowMouseCursor does (IE setting bShowMouseCursor enables the mouse and starts tracking it, unsetting bShowMouseCursor just hides it).

ISSUE 2: Mouse doesn't even show up in the play in editor views. Only in standalone.

I know this has come up but the solutions seemed very hacky. Any help would be greatly appreciated.

 // Called to bind functionality to input
 void AVehicleEditorPawn::SetupPlayerInputComponent(class UInputComponent * InputComponent)
 {
     Super::SetupPlayerInputComponent(InputComponent);
 
     InputComponent->BindAction("Secondary",
         IE_Pressed, this, &AVehicleEditorPawn::SecondaryPressed);
     InputComponent->BindAction("Secondary",
         IE_Released, this, &AVehicleEditorPawn::SecondaryReleased);
 
     // ...
 }
 
 void AVehicleEditorPawn::Tick(float DeltaTime)
 {
     Super::Tick(DeltaTime);
 
     static auto * const PlayerController = GetWorld()->GetFirstPlayerController();
 
     // Enable / disable cursor based on Secondary
     PlayerController->bShowMouseCursor = !SecondaryCurrentlyPressed;
     PlayerController->bEnableClickEvents = !SecondaryCurrentlyPressed;
     PlayerController->bEnableMouseOverEvents = !SecondaryCurrentlyPressed;
 
     // ..
 }
 
 // Secondary Pressed
 void AVehicleEditorPawn::SecondaryPressed()
 {
     SecondaryCurrentlyPressed = true;
 }
 
 // Secondary Released
 void AVehicleEditorPawn::SecondaryReleased()
 {
     SecondaryCurrentlyPressed = false;
 }
Product Version: UE 4.9 Preview
Tags:
more ▼

asked Aug 13 '15 at 08:47 PM in C++ Programming

avatar image

codysmith105
36 4 8 11

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

1 answer: sort voted first

A few things to try:

Make sure to set your default mouse cursor on your player controller at some point:

 CurrentMouseCursor = EMouseCursor::Default;

Use SetInputMode(..) on your player controller when you want to capture the mouse (e.g. control a vehicle or the camera). This will fix your "moved to the edge of the window" problems.

Use 'GameOnly' for full mouse capture in the game world:

 FInputModeGameOnly InputMode;
 SetInputMode(InputMode);

Use 'UI only' when you want to only interact with screen-space widgets:

 FInputModeUIOnly InputMode;
 InputMode.SetLockMouseToViewport(false);
 InputMode.SetWidgetToFocus(SomeWidget);
 SetInputMode(InputMode);

Try playing with 'GameAndUI' if you want to mix behaviors:

 FInputModeGameAndUI InputMode;
 InputMode.SetHideCursorDuringCapture(true);
 InputMode.SetLockMouseToViewport(true);
 SetInputMode(InputMode);

Note that there is a limitation in UE4 at the moment where you will probably need to set your desired InputMode again when you are handling a mouse-up event.

more ▼

answered Aug 15 '15 at 11:44 AM

avatar image

cancel
2.4k 101 72 123

(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