question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't send CharacterMoveInputEvent if I don't input anything

See original GitHub issue

Motivation

During a debugging session I noticed, that the LocalPlayerSystem sends a CharacterMoveInputEvent every tick, even if I’m not pressing any key and not moving the mouse at all.

See https://github.com/MovingBlocks/Terasology/blob/develop/engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java#L175-L176

This does IMO not only create a lot of unnecessary events that might negatively impact, but it also creates a lot of “noise” and makes it harder to debug.

Proposal

Exit early from LocalPlayerSystem#processInput if there is no input, e.g. no keyboard input creating movement and no mouse or VR input creating view rotation.

My hope would be that this improves performance and reduces unnecessary noise.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
skaldarnarcommented, Jan 27, 2022

A wild guess on this: gravity on characters seems to come from apply downwards pull on every (affected) movement event. Therefore, might it be necessary to send “dummy no-change events” just to have the gravity be applied to characters each tick?

And since we only do this repeatedly for the player characters, NPCs are affected by gravitiy as soon as they move (e.g., walk or jump), but are not affected by gravity if just standing around… 🤔

0reactions
jdrueckertcommented, Jan 30, 2022

That actually makes sense 🙈 I would argue that this should ideally be done separate from actual movements, but guess it’s quite entangled at the moment and hard to “unfiddle”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Computer not taking input from Keyboard / Mouse
In Safe Mode enter Device Manager reached by right clicking the Start button, choose the Mouse and Keyboard devices, then from Driver tab...
Read more >
c# - What would cause SendInput to stop working after each ...
However, when attempting to send this input to a certain application, SendInput only works for the first instance of a certain key.
Read more >
How To Fix Keyboard Not Working During Login On Windows 10
If your keyboard is not working/being detected while booting up your Windows 10 computer, this tutorial is for you. Occasionally, when you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found