rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.21k stars 263 forks source link

rexVirtualJoyStick - Prevent snapping back to 0? #369

Closed nt294 closed 1 year ago

nt294 commented 1 year ago

Is there a way to prevent the joystick snapping back to zero? in other words, increase the area that the joystick can be moved around in?

rexrainbow commented 1 year ago

I can create a test for increasing the area (base on radius input parameter) later. However, I don't know why increase the area can prevent the joystick snapping back to zero. Could you explain prevent the joystick snapping back to zero more detail? An image might be better, imo.

nt294 commented 1 year ago

Sorry, I should have been more clear - what I mean is when the joystick returns to the centre it 'snaps back' in the sense that the force and angle jump back to zero when they go under a certain threshold.

joystickGif

rexrainbow commented 1 year ago

Thumb will return to center when pointer-up, i.e. does not have any key-press, then the force and angle will be 0. I though it is a normal behavior, sorry I can't get your point.

nt294 commented 1 year ago

In the gif, when the force goes under about 20, it automatically jumps down to 0. Meaning for example, I cannot apply a force of 5. I am keeping the pointer down, so the pointer up event is not firing

rexrainbow commented 1 year ago

Might try to set forceMin input parameter to 0 ( see create instance), then you can have a small force value.

nt294 commented 1 year ago

Thanks, that works nicely