[HTML5] Getting Cursor Position, PC::DeprojectMouseToWorld Only Works if Cursor is Visible

Dear Friends at Epic,


  • If you package a game for HTML5 where APlayerController::DeprojectMousePositionToWorld is being used, this function will only return true / give valid data if APlayerController::bShowMouseCursor is set to true.

This is not the case in a non-HTML5 game and is inconvenient if the user wants to use a particle or a mesh as a cursor in full 3D instead of the OS cursor widget

Workaround: I can use an empty widget as the mouse cursor to hide the fact that it is visible, however this is just a hack for the real issue of HTML5 games not being able to retrieve the cursor position unless the cursor is visible.


Actually nevermind, OS software cursors dont work in HTML5 it seems, it defaults back to the regular cursor


To be precise, the software OS cursor does show up, but so does the regular white OS cursor.

It would seem that APlayerController::bShowMouseCursor is being used to interact with the HTML5 OS to show the cursor, and somehow the process of retrieving the position gets broken if bShowMouseCursor is false.

It would be lovely to be able to get the HTML5 OS cursor position while APlayerController::bShowMouseCursor is false.


I am stuck with having to use the visible standard OS arrow for the targeting reticle for my HTML5 game unless you awesome HTML5 devs can think of a way for APlayerController::DeprojectMousePositionToWorld to give valid data even while bShowMouseCursor is false.

Thank You

I am loving the development of HTML5 support for UE4, yay!

My comments are only meant to further assist that development :slight_smile:



Hey Rama,

Thank you for your thorough investigation with the HTML5 cursors. I have submitted a feature request. I can’t promise it’ll be added into the engine but it will be reviewed. The Jira for this is UE-24648.

Thanks again!


I’ve received additional information from UE-24648. We’d like to know what type of game you’re developing? Because if the mouse pointer is used, the browser will “lock” the X and Y (screen and application relative) positions and only update the “movementX and movementY” properties.

However, if you’re trying to keep the mouse visit, you can change the look of the cursor to what you want.

here’s some information on how to do that: Information on changing your cursor

and an example: Cursor Example

Dear Samantha,

Thank you for the links for changing cursor types Samanatha!

I am making a game that is guided by a top-down 3D mesh/particle cursor, similar to this game:
<div class="lazyYT" data-youtube-id="orLxrg51xL8" data-width="480" data-height="270" data-parameters="feature=oembed&amp;wmode=opaque"></div>
# My Solution

The solution I ultimately implemented was to capture mouse delta myself and update a "virtual" cursor whose coordinates have nothing to do with the actual mouse position

Again I went this route because I could not use APlayerController::DeprojectMousePositionToWorld

I am instead using APlayerController::DeprojectScreenPositionToWorld and supplying my virtual cursor's position

Again the complication here is that the mouse position does not seem to update in HTML5 OS when the cursor is hidden, but as you mentioned changes in mouse are still reported, so I can use the deltas and my own virtual position.

# Community Offering ~ Victory BP Library

I've created static BP nodes to allow anyone in the community to show or hide the HTML5 cursor at will, as part of my Victory BP Library