GETJOY question

Previous topic - Next topic

UBERmonkeybot

Hi,
When i run the following code i am consistenly getting values in  xx and yy outside -1 to 1 how can this be possible?

Prob me being stupid again.


Thanks in advance.

Code (glbasic) Select

REPEAT

LOCAL xx#,yy#,b

FOR i=0 TO GETNUMJOYSTICKS()-1
xx#=GETJOYX(i)
yy#=GETJOYY(i)
b=GETJOYBUTTON(i,0)


IF xx#<-0.991 THEN xx#=-1
IF xx#> 0.991 THEN xx#= 1
IF yy#<-0.991 THEN yy#=-1
IF yy#> 0.991 THEN yy#= 1
DEBUG "\ni "+i+" xx "+xx#

NEXT
PRINT "Joytest",100,100
SHOWSCREEN



UNTIL FALSE

erico

Didn´t look at the code yet, are you sure your joy is calibrated?

UBERmonkeybot

I just checked that and it made no differenece

UBERmonkeybot

#3
The program works as expected on android.
I notice that my wireless xbox controller gives these large numbers (upto 9,-9) when i let the joystick snap back to center.
It does it on both sticks.
But surely the software should catch the fact that xx is limited to 1,-1

I note in the Manual that this is for registered users only,I am not registered but the command seems to work(sort of)

nabz32

#4
Could it be the 9 is actually 9 , .... e^-x ??
then it is a very small number close to zero,
missread this once also.

Edit:
x^-2 = 1/(x^2)

UBERmonkeybot

Ahha i think you may be right.

i Get this as an output

Joy 1  xx -0.1538438052  yy 1.333658863e-002             Joy2 xx -2.954191715e-002  yy 5.148472637e-002
Joy 1  xx -0.6840723753  yy 5.056916922e-002             Joy2 xx -2.954191715e-002  yy 5.148472637e-002
Joy 1  xx -0.8983428478  yy 5.056916922e-002             Joy2 xx -2.954191715e-002  yy 5.148472637e-002
Joy 1  xx -1  yy 6.546220183e-002                                 Joy2 xx -2.954191715e-002  yy 5.148472637e-002

spacefractal

you property should uses FORMAT$ or use interger and multiply with 1000 for a more user feedback.

As you not see zero is pretty normal, if you not measure deadzones.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

UBERmonkeybot

I assume that if i didn't count anything under 0.2 would count as a deadzone.