there was a thread I made a while back, where you need to multiply and so on by an amount to get accurate readings and if you do so the spikes seem to disappear…
Yea some people are reporting smooth movement, and others are saying it jitters. If you’re not seeing any jitter, that’s a good thing! Scary bug though, some people encounter it, others dont.
I just bought Rewired ($80AUD) and unfortunately the problem still occurs.
I completely removed all input systems except the new input system. Same issue.
I’m pretty sure it has something to do with the Cursor.lockState = CursorLockMode.Locked behaviour.
For now I’m going to have to give up and not work on any first person browser games.
FINAL EDIT:
Okay, this is not a Unity Bug. This is occuring on any game using some kind of Cursor Lock, including from other engines. I guess some people’s computers are just broken. This happens on Edge, Chrome and Brave.
Yeah, it happen also on krunker.io that use another engine.
The webgl canvas do not lock and put the cursor in the middle of the screen like in the other platform, double screen can also be an issue?
I must say that i’m lost with this. I have it in all my games since we had to switch from unity web player for WebGL but like it happen randomly, it’s hard to find the main issue.
I will keep posting my findings as it seems other people are having this issue.
I used anydesk to remote into my computer. This allows me to see the position of my mouse even when it’s locked and hidden in the application.
Using remote desktop, the delta spike occur predictably and constantly whenever the mouse is within ~5% of the edge of the canvas and any point behind.
Perhaps because the browser can not fully control the remote mouse position, it’s behaving this way.
I assume what usually happens, is that this behaviour is repressed in some way by Cursor.LockState, however it’s plausible that sometimes these insane deltas are leaking through when the mouse is within 5% of the edge or beyond.
These spike are very large. If a typical delta is 1 unit, the spikes are often 500 - 1500 units.
one thing i will add to your thoughts a while back, i was using zone alarm and although i was playing my webgl game, every keystroke even though webgl runs on your pc not the server, was sending all the keys and mouse movements out, so, it was causing a major bottle neck and so instead of being able to say pres W to move forward it was like watching altar boys walking in church it was like one step pause, one step, pause… Despite proving it and the fact it only happened under webgl and (I also had locked mouse pointer at that point, in fact this was one of the reasons I ditched it) while zone alarm made it worse, it was not the entire cause… it just made it heck worse… unity on being presented with logs, and many people being above to prove they had the same issue… didnt care when i logged it as a bug
I can reproduce the issue on that page. Although I am not 100% sure if I am observing the same issue. You wrote “the mouse delta will randomly spike by extreme amounts.”. From what I am seeing, I would not use the term “extreme” to characterize the issue, but there is still a clear discontinuity/abrupt jump in mouse delta values.
For me it looks like if I move the mouse cursor very slowly, the movement stays continuous. However if I pick up the mouse movement velocity to a little bit faster speed, there is some speed threshold after which the view suddenly makes a jump of maybe a few centimeters on screen.
Although I have a Razer 8kHz gaming mouse on this system, which I know works poorly with many Windows apps. The 8000 Hz polling rate breaks many games (Deep Rock Galactic, Mechwarrior 5 and Ascent that I’ve played in the past year). In those games I observed the exact same issue: making slow mouse movements would be fine, but doing too large movement would cause an abrumpt jump.
On some of those games, I recall I worked around the issue by changing in Razer mouse control panel the mouse polling rate down to 1000 Hz, though I don’t have the control panel installed atm to see if that would help the issue.
No idea if you might have a high Hz polling rate mouse, and if not, then what I am typing is probably not related at all to the issue at hand.
That’s why there is a fully-functional free trial for evaluating it before purchase. Submit a request for a refund to the Unity Asset Store and they will refund you.
The reason for this was the use of the non-buffered Raw Input function to get the latest data from the window message buffer. This caused an internal mutex lock with each call, which resulted in massive slowdowns when hundreds of mouse events from an 8Khz mouse are processed each frame, one at a time. The change to using the buffered Raw Input function eliminated this slowdown because there is only one mutex lock per frame no matter how many events are waiting to be processed.
Mouse input would be implemented through an API exposed by the browser. This could be a browser dependent issue and require changes on their end.
It seems like it would be easy enough to write a script to test the values returned by the browser for the mouse position when the pointer is locked by Unity see if the delta spike is present. If you still get the delta problems, try locking the pointer yourself instead of through Unity. If the spike is present in all cases, it’s very likely a browser issue that could only be fixed there. Try a different browser based on a different engine and repeat.
I’ve had about 7 people test and only one other person besides myself noted it. Seems like it’s hardware specific, but not browser specific (at least chromium based browsers)
Curious, the video makes it looks like theres a frame drop and then it makes up for it in one go so the mouse delta is a cumulative jump for all the lagged frames.
I don’t think that’s case simply because the spikes are so large (equivalent of rotating several times) and that sometimes moving in the X delta cause a spike in the Y delta.
When I loaded my computer for the first time, it wasn’t occuring. The longer my computer has been on the worse it’s getting. I also confirmed it happens on Firefox. I think it might just be a problem with my Mouse, because only one other person reported the issue and I asked them to check again.
I should be glad, because it seems like a bug no one else is encountering, but it bothers me that I’m not going to be able to playtest my own WebGL games.
Tested a second mouse, still happening, so it’s not a mouse issue.
If it’s only happening on one computer and not another, I would suspect some software running on that system. Anti-malware software, key mapping software, virtual XInput device software (DS4, Wii, etc.), video/screen capture software that hooks the window, screen sharing software, anything that can put an overlay on the window (Discord, etc.), etc. Anything that might need to monitor and/or modify input or receive an event when the mouse pointer would go outside the active window border. Less likely would be drivers including mouse and video. If these are Bluetooth mice, there are more possibilities including the BT adapter, driver, other BT devices, but I find the idea that this problem could be caused by the mouse hardware itself very unlikely since you said the issue happens when the mouse pointer goes outside the window when using Remote desktop. That symptom makes it sound like software because the mouse itself doesn’t know anything about the application windows. I wonder if an WebGL game would run in Windows safe mode. That would eliminate a lot of drivers/software at once.