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"

[Closed] Mouse axes are zero when there is no mouse press

This is how I try to use mouse axes

 [/Script/Engine.PlayerInput]
 !AxisMappings=Empty
 +AxisMappings=(AxisName="MoveForward", Key=MouseY, Scale=1.f)
 +AxisMappings=(AxisName="MoveRight", Key=MouseX, Scale=1.f)
 
 !ActionMappings=Empty
 +ActionMappings=(ActionName="MouseClick", Key=LeftMouseButton)

Then I bind actions and axes in C++

 BIND_ACTION(InputComponent, "MouseClick", IE_Pressed, &APlayerPawn::OnMouseClick);
 BIND_AXIS(InputComponent, "MoveForward", &APlayerPawn::OnMoveForward);
 BIND_AXIS(InputComponent, "MoveRight", &APlayerPawn::OnMoveRight);

When I start game from Visual Studio MoveForward and MoveRight functions receives proper axis values. But when I click mouse button this functions receives only zero values until left or right mouse button pressed.

What am I doing wrong?

Product Version: Not Selected
Tags:
more ▼

asked Mar 11 '14 at 01:47 AM in Bug Reports

avatar image

ue4-archive ♦♦ STAFF
50k 3670 1999 9124

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM

Still same thing with GetInputMouseDelta() on Beta5 for me. GetInputMouseDelta() returns zeroes till you press any mouse button. So for me, i can use it only if i hold one of mouse button. Did this bug was removed in beta 5 or still not?

How to reproduce this bug: in playercontroller's ProcessPlayerInput():

 FVector2D MousePos;
 GetInputMouseDelta(MousePos.X, MousePos.Y);

and try to look what will be in MousePos when you only moving mouse, and when you holding any mouse button and moving mouse

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM

in beta 6 still same bug. when will it be fixed? :(

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

The question has been closed May 18 '14 at 07:46 PM by Adam Davis for the following reason:

Problem is outdated


4 answers: sort voted first

Hi indygoof,

Please make a new post about your specific concern. This is an archived post from pre-release. Closing the thread as outdated. Thank you!

more ▼

answered May 18 '14 at 07:45 PM

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

Hi Alex. I was wondering if I could a bit more details on your setup and the specifics of the issue you are seeing.

I setup my DefaultInput.ini as you specified and then bound the axis and action events in the level blueprint to print out the values that the events received. My experience was that the mouse delta values coming in through MoveForward and MoveRight appeared as expected regardless of whether the left mouse button was pressed or not once the window had mouse capture.

alt text

If you use this same setup do you get the same problematic behavior? There was a bug that could have lead to what you see in Beta3 but should be fixed in Beta4.

mousebindings.jpg (46.2 kB)
more ▼

answered Mar 11 '14 at 01:47 AM

avatar image

ue4-archive ♦♦ STAFF
50k 3670 1999 9124

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM

Just checked. With this setup behavior is the same. I think the problem in setup. I am using PlayerPawn class inherited from APawn. So maybe there are some variables that needs to be configured.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM

Can you confirm that you are using Beta 4? When you do Help -> About what is the Version #?

Can you give me more details as to why you think you might a problem in the setup? I can't really think of anything you could do variable wise that might have such a behavior.

It might also be useful for you to try using a new project based on something like the first person template and try this setup there as well.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM +

Just wondering if someone has a chance to reproduce this issue with my sample project?

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM

Hello Alexander,

Are you experiencing this issue on Beta 6?

Thanks,

Sean

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

I am not exactly sure what all is going on here

but here's a solution if you want to get the mouse position in screen coordinates at any time :)

.h

 float MouseX;
 float MouseY;

.cpp

 void AVictoryGamePlayerController::UpdateMouseCursor()
 {
     
     //set the values of MouseX and MouseY
         GetMousePosition(MouseX,MouseY);  //playercontroller.h
 }

I run the above in my player controller's PlayerTick function

What exactly are you trying to do with the axes?

Rama

more ▼

answered Mar 11 '14 at 01:47 AM

avatar image

ue4-archive ♦♦ STAFF
50k 3670 1999 9124

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:47 AM +

Actually I'm trying to use mouse axes for camera movement, so I need deltas. I know that I can store mouse position each frame and calculate deltas, but I think that using axes is much more suitable.

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

Since i got the same problem here, no matter if i get the axes from InputBindings or from GetInputMouseDelta, i always only get values != 0 when i do a mousepress too, is there any solution to this?

Thanks in advance, Indy

more ▼

answered May 18 '14 at 05:20 PM

avatar image

indygoof
830 26 15 41

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

Follow this question

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

Answers to this question