SetMoveOverride does not work when requiresCursor widget is showing

Describe the bug:
Calls to “SetMoveOverride” do nothing if at least one requiresCursor widget is present.

Since SetMoveOverride is API call made from scripts, it is up to creator to decide when to call it or not, thus making character move or not. Crayta should not stop creators from making characters moving regardless of whether displayed widgets require cursor or not. It is obvious that when widget requires cursor, movement caused by wasd/left-stick-input/touches-on-left-side-of-mobile-screen should be disabled, cause otherwise input into widget would be possibly interpreted as movement,etc.
However scripted movement should not be denied.

Fixing this would allow us to make very interesting solutions for some games. F.e. in Spellfire I would be able to make custom very efficient mobile controls. Without this, I could only make a very ugly hack making player character as NPC instead of actual character (not easy and extremely not convenient).

How do you cause this bug?

  • Create widget that requires cursor
  • write script which calls SetMoveOverride making player move up

Call would be ignored and player won’t move, while expected it to move.

Which platform: PC

Which input: mobile mostly, but also other controls too would be nice (for debugging)

Your Crayta username: strowk

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): always

Time + date seen: 31.07.2022

Version number (found in Help tab in Settings): 0.g2.53.127708

Ah, I see this was already filed
SetMoveOverride in widgets with cursor - Bug Reports - Crayta

needs attention…

Hi @str,

Thanks for your report. I’ve updated the report our side and we’ll chase it up.

Hi @str,

Could I possible grab an example script from you to test this with please?

Thanks in advance!

Hey, I made better - there is minimal reproducible example in game called “Bug Example - 3067”. I believe you could access games even unpublished from inside, right? So that one is supposed to work this way: you press B (on PC, otherwise whatever is extra6), player should start moving right. However because of requiresCursor widget - it won’t. If you uncheck “Requires Cursor” on RequiresCursor widget (on Player template), then pressing B would work as expected.

Code of “moving” script is following:

function MovingPlayer:OnButtonPressed(name)
	if name == "extra5" then
		self:GetEntity():GetUser():SetMoveOverride(Vector2D.New(0,0), Vector2D.New(1,0))

@str thanks, that’s perfect. I’ve grabbed a copy of the example game and updated the report with the repro.

Hey, sorry, I was in a hurry and made a logical mistake when making that example. I have changed it now so it reproduces the issue better now. In previous example SetMoveOverride was not even called (I forgot that requires cursor blocks OnButtonPressed too, which is not the issue here). I changed example - now there is a big button in the middle of widget which is calling in the end SetMoveOverride (and you can see it is called in logs).
Different way of calling the same function with B button would work only if requires cursor is disabled, just to demonstrate what should be happening (player starts running).

You probably need to make another copy :slight_smile: Sorry again

Ah no worries, I will get a fresh copy taken and update the report! Thanks for letting me know.