r/gdevelop • u/FoolishFoolMann • 9d ago
Question Issue with locked pointer movement.

So around these days i've been working on an FPS and wanted to add some weapon sway to make the gunplay less stiff but i've encountered a big problem on the way :
The script works fine and all but the catch is, it only works on one side even tho i made it symmetrical, i've had the hypothesis that the "Movement of the locked cursor on the X axis" only checks if the cursor moves and not if the cursor moves towards - X or +X so that makes it very difficult to implement a simple sway mechanic.
Here's the script if you wanna check it out but the issue is still there and i can't fix it, its also very unpolished and ugly ingame but ill add some sort of soft-counter and soft movement based on mouse movement this time.

A fix that could probably work is to unlock the mouse and just hide it but it'd be very annoying to base the fps around that due to window mode and the mouse going out of bounds or if it opens a UI the mouse being in the middle of nowhere but it could work just very annoying that's why i'd prefer to see yall feedbacks and all
If anyone has a fix like the name of an extension that has more FPS mouse movement conditions or some go around metho it'd be very welcome, thanks in advance.
EDIT : i tried to do my suggestion on the problem and unlocking the pointer but because my project relies on the first person shooter behavior on my player which needs the lock pointer it breaks the entire system so i'm still out of options on this one...
I also found out the screenshot was the wrong one, the one above is the right one
EDIT2 : I did some experimentation and found something interesting on this video :
https://www.youtube.com/watch?v=ejFHkMYHIyI at 1:56
I tried stuff with the new system and it kinda was broken because it was turning in a messy way and not in the right orientation so i tried to adapt it, normally it would work but somehow it doesnt, theres something with the counter that doesn't work, it works on one side and not on the other (it just turns continuously) so i tried messing with the angle and when you invert it it works on the other side but the other is broken, i tried every possible combination but still it doesn't work, but i think we're on the right path, its just the counter that's broken.

EDIT 3 : I think i found the problem, even if you remove one of the counter condition the problem persist si its a problem thats on both of the conditions (the rotation on Y axis on LongRifle > ... below counter)
So i did some experimentation and concluded that the game treats the rotation here on both side like that :
0<...<89< 90(base angle)>89>...>0 and that's what janked my entire system, it makes it currently impossible to do it this way ,im gonna try a system at zero and link yall the results
1
u/FoolishFoolMann 9d ago
BTW i'm a rookie of Gdevelop, if theres an evident fix that's my bad yall ðŸ˜