still need your help guys on something.
do someone know how can i move the gamecursor with gamepad Right Stick coordinates.?
I’ve targeted a global variable called GamepadaimX to (Gamepads::AxisValue(1,“RIGHT”,“HORIZONTAL”)) which is max 1 when positive and max -1 when x negative, i did the same with Vertical :
Globalvar GamepadaimY = (Gamepads::AxisValue(1,“RIGHT”,“VERTICAL”)).
So what can i do to make the cursor follow the center of right stick x,y coordinates? I mean…aim with stick…
THE CURSOR MUST BE MOVED AS MOUSE WITH THE GAMEPAD RIGHT STICK AND NOT JUST POINTING TO RIGHT STICK ANGLE.
The problem i have is that mouse x,y coordinates ovveride any position, so i need to disable them and follow the right stick ones…and im really stuck here
I really need to implement this in my game.
You’re going to need to disable the normal mouse cursor entirely, and use a sprite that is positioned to the MouseX/Y position. Once you’ve got that set up as an event, add another condition that is your gamepad right stick is moving, and invert it.
This will ensure the mouse cursor sprite is only moved whenever the right stick isn’t moving. (Note: You might also need to setup an event that tracks the prior MouseX/Y cursor position and only moves the cursor sprite if the new position is different)
Outside of that, you’re going to need to decide how you want to translate the right stick to cursor movement. Most games do some kind of “If slightly pressing to the right, add 2 to the X of the cursor” “If fully pressing to the right, add 4 to the X of the cursor”, etc.
But there aren’t any standards and no “best” way to do it in GDevelop.
Thank you for the input.
I’m gonna try with your method.
Was already my intention to disable the mouse and use a different object as a cursor reference.
But i think that i don’t need to add or increment the x position manually since the Gamepad extension already “lerp” the stick input.
The problem is that i probably suck at trigonometry and i don’t know how to turn for example the max value of the right stick to right (which is +1) to my x coordinate.
i’ve though to use the camera max bound and multiply it by the stick value, but honestly i don’t think that is a good method…
Anyway i’ll let you know.
If someone have other methods pls post.
How to get the max boundary of the screen?..i’m thinking something…
maybe i can use to move object toward stick position, using the screen bounduary as max distance and use percent as divider.
Posting the solution here.
-install gamepad extension … ofc
-Get rid of the mouse cursor by creating a new object that will be your new cursor YOU CAN HIDE IT WITH THE MOUSE EXTENSION,
-create 2 global variableS for stick coordinates like this:
-update your crosshair position with this:
where first part is the origin, then add x value that is the result of the stick value multiplied for half screen camera.
Do the same for y coordinates.