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"

Can't look around with camera after Eject from Play in Editor

After I hit "Eject" during "Play in Editor", I can't look around with LMB or RMB, even though holding down either and using WASD will move the camera around (same with using Q/E and the such to move it up and down).

I am using custom c++ classes for the game logic, most of it based on the StrategyGame example that can be downloaded (including the camera component). The same behavior of not being able to look around after ejecting occurs in the StrategyGame project as well.

Camera movement works perfectly in any viewport outside of the main one after starting Play. Not using the custom game mode and classes will not cause this to happen either.

My question is, what can affect the Editor camera after ejecting in the editor? If anyone is more familiar with the StrategyGame example, why does it break the camera movement in editor in the main viewport during play (after eject)?

Product Version: UE 4.11
Tags:
more ▼

asked Apr 03 '16 at 03:20 PM in C++ Programming

avatar image

Dwel
21 2 3 7

avatar image nynjed Apr 07 '16 at 08:13 AM

Happened to me too in 4.11.

Maybe this is reason:

"Bugfix: Camera roll is no longer applied to level viewport cameras after ejecting from the player in a PIE session in the existing editor viewport."

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

1 answer: sort voted first

I have temporary fix for engine. Hope it will not break something else.

Open File ....\Engine\Source\Runtime\Engine\Private\Slate\SceneViewport.cpp

And insert this to 443 line:

 ReplyState.UseHighPrecisionMouseMovement(ViewportWidgetRef);

Code will be look like:

 if (World && World->IsGameWorld() && World->GetGameInstance() && World->GetGameInstance()->GetFirstLocalPlayerController())
     {
         bool bShouldShowMouseCursor = World->GetGameInstance()->GetFirstLocalPlayerController()->ShouldShowMouseCursor();
         if (ViewportClient->HideCursorDuringCapture() && bShouldShowMouseCursor)
         {
             bCursorHiddenDueToCapture = true;
             MousePosBeforeHiddenDueToCapture = MousePosition;
         }
         if (bCursorHiddenDueToCapture || !bShouldShowMouseCursor)
         {
             ReplyState.CaptureMouse(ViewportWidgetRef);
             ReplyState.LockMouseToWidget(ViewportWidgetRef);
             ReplyState.UseHighPrecisionMouseMovement(ViewportWidgetRef);
         }
         ReplyState.UseHighPrecisionMouseMovement(ViewportWidgetRef); // <-insert here
     }
     else
     {
         ReplyState.UseHighPrecisionMouseMovement(ViewportWidgetRef);
     }
more ▼

answered Apr 08 '16 at 12:26 PM

avatar image

nynjed
25 3 7 10

avatar image Dwel Apr 08 '16 at 07:26 PM

Hello, thanks for the reply.

I've tried the above posted change to the SceneViewport.cpp, however it did not change anything within the editor. (built the code in visual studio and restarted the editor; also built and ran the editor directly from visual studio).

I've set up some breakpoints in the code segment, though none of them triggered in Visual Studio while attached to the editor.

avatar image nynjed Apr 11 '16 at 08:47 AM

Are you using git version of engine or from launcher? If from launcher, you have only one way - waiting for a bugfix from epic themself. Because editing engine from launcher version never changed anything for me.

Or switch to git version.

And I discovered that camera works good in the FPS projects after "eject". Because bShouldShowMouseCursor (see in code) in shooter is hidden by default, so code execution can get into that "if" branch.

I've set up some breakpoints in the code segment, though none of them triggered in Visual Studio while attached to the editor.

If you want set breakpoints into engine code - you must set "Debug Editor" as solution configuration, not "Development...". Not sure - maybe this enough for launcher engine, or maybe this required git-version too.

avatar image Dwel Apr 11 '16 at 11:34 AM

I was afraid of that, thanks for the clarification. I am not using the git version, simply the official one.

I will have to wait for a bugfix then. I'm glad it's nothing within my project code that's causing this specifically.

(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