There seems to be a discrepancy between the output of Get Mouse Position node depending on whether the node is inside an Actor function or called from Event Tick. If the node is present inside a function, then as soon as the mouse cursor leaves viewport/window area, the node returns 0, 0 vector. If the node is present in the event graph, not wrapped inside any function, then if the cursor leaves viewport, the node keeps reporting last known cursor position.
(Project has been attached for easy replication & reproduction)
1. Open up Unreal Engine 4.21 and Create a blank project.
2. Create a Actor Blueprint named "Report Mouse XY"
3. Right click on the Event Graph-> Get Player Controller
4. Off of Get Player Controller -> Get Mouse Position.
5. Off of location X and Y, Make a Vector 2D.
6. Off of Make Vector 2D Return value, call function BuildString(Vector2d)
7. Off of Event Tick, Create a Sequence Node.
8. For Sequence 0, pull off a Print String Node.
9. Plug in the return value of Build string into the In String of Print String.
10. Create a custom Get Mouse Position Function (see GetMousePosition CustomFunction.png)
11. Call Get Mouse Position Custom Function.
12. Make a Vector 2D from Location X, and Y
13. Off of the Return value, use BuildString(vector2d)
14. Add another pin to sequence, and plug in Print String.
15. Compile & Save
16. Play In Editor, and move the mouse cursor across the viewport. Until it is off the viewport.
17. Observe the numbers of In Event Graph, and Inside of Function.
Result: Get Mouse Position node returns 0, 0 result as soon as the mouse cursor leaves viewport area if the Get Mouse Position node is contained within a blueprint function.
Expected: Get Mouse Position node should always return last known cursor position if the cursor exits the viewport, whether it is called from Tick, or from the Actor pure function.
i have this problem UE4CC-Windows-58DC12AF4B97F057BD108FBFF569B2E9_0000
I am not able to find world outliner how to enable it?
Delay nodes occasionally don't fire the "Completed" output in a nativized build
How can i modify the param name in EQS node
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
Hey, why do i get this when i snap two similar meshes together?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-66596 in the post.
1 |
Component | UE - Gameplay |
---|---|
Affects Versions | 4.20, 4.21 |
Created | Nov 15, 2018 |
---|---|
Resolved | Nov 19, 2018 |
Updated | Nov 26, 2018 |